java3d
  1. java3d
  2. JAVA3D-385

JCanvas3D non-AWT MouseBehaviors don't work.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: 1.6.0
    • Component/s: j3d-core-utils
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      385

      Description

      In JCanvas3D non-AWT MouseBehaviors that are added to the SceneGraph do not
      function. However, if any one MouseBehavior of type AWT Listener is added as a
      Component listener, then all Behaviors work; even the non-AWT ones.

        Activity

        Hide
        kcr added a comment -

        Assign to pepe for 1.5.0 as P4 bug

        Show
        kcr added a comment - Assign to pepe for 1.5.0 as P4 bug
        Hide
        kcr added a comment -

        Set target release to 1.5.1

        Show
        kcr added a comment - Set target release to 1.5.1
        Hide
        kcr added a comment -

        Set target to next release.

        Show
        kcr added a comment - Set target to next release.
        Hide
        hvieten added a comment -

        I'm just trying to use JCanvas3D instead of Canvas3D in an existing project.
        This project contains a class which subclasses Behavior and uses
        WakeUpOnAWTEvent to react on clicks on points (picking, etc.). The problem was
        that processStimulus() of the Behavior subclass was never called.

        The reason for that is the way events are handled internally by Swing. JCanvas3D
        passes MouseEvents to the offscreen Canvas3D in its processMouseEvent() method.
        But as long as no MouseListener is registered with the Component or
        enableEvents() is called with the event mask of the event, this method is not
        called.

        I think this could also be the reason for this bug. Calling enableEvents() with
        the appropriate event masks just after the offscreen Canvas3D was initialized
        should fix it. Another nice effect would be that OrbitBehavior probably would
        work again. I'm using a modified version of it in my project and call
        enableEvents() on the JCanvas3D for the events:

        enableEvents(java.awt.AWTEvent.MOUSE_EVENT_MASK);
        enableEvents(java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK);
        enableEvents(java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK);

        After that I can rotate and translate the view.

        Show
        hvieten added a comment - I'm just trying to use JCanvas3D instead of Canvas3D in an existing project. This project contains a class which subclasses Behavior and uses WakeUpOnAWTEvent to react on clicks on points (picking, etc.). The problem was that processStimulus() of the Behavior subclass was never called. The reason for that is the way events are handled internally by Swing. JCanvas3D passes MouseEvents to the offscreen Canvas3D in its processMouseEvent() method. But as long as no MouseListener is registered with the Component or enableEvents() is called with the event mask of the event, this method is not called. I think this could also be the reason for this bug. Calling enableEvents() with the appropriate event masks just after the offscreen Canvas3D was initialized should fix it. Another nice effect would be that OrbitBehavior probably would work again. I'm using a modified version of it in my project and call enableEvents() on the JCanvas3D for the events: enableEvents(java.awt.AWTEvent.MOUSE_EVENT_MASK); enableEvents(java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK); enableEvents(java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK); After that I can rotate and translate the view.

          People

          • Assignee:
            pepe
            Reporter:
            petroslj
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: