Java3D bug using JDK11

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Java3D bug using JDK11

DonPearson
While porting my software over to the JDK11 environment,  I noticed the following bug that I would like to report:  when running Java11, I have lost the middle mouse button functionality that exists with the same code running under Java8.  That functionality was used to zoom with the mouse:

//Set up ZOOMing behavior around TG3.
    MouseZoom mouseZoom = new MouseZoom(); //CENTER BUTTON (or ALT-leftButton)
    mouseZoom.setTransformGroup(tg3);
    mouseZoom.setSchedulingBounds(bs);
    tg3.addChild(mouseZoom);
    mouseZoom.setFactor(0.001);
    //System.out.println("mouseZoom");


A little bit more insight into the MouseZoom anomaly:  in JDK8, my software works as expected: the left mouse button is programmed and works as expected,  the center mouse button also works as expected (shown above), and the right mouse button is not programmed, but works like expected (i.e. it does nothing).    The JDK11 version of the software has all three buttons behaving as if they were the left button. I was able to move the code snippet for the center mouse over to the MouseWheelZooom class and now it behaves as programmed.  All of these mouse classes come from javax.media.j3d.SceneGraphObject -- so something must have changed up at that level in javax to cause the anomalous functioning of the center and right mouse buttons.
Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

gouessej
Administrator
Hello

By the way, try with Java3D 1.7 too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

DonPearson
Just want to make sure I know where the official release of Java3D 1.7 is?    If I go to the thread at the top of this site (http://forum.jogamp.org/JogAmp-s-Java3D-continuation-Java3D-1-6-0-and-later-td4030907.html) and click on the "follow these steps link", I can see a translated page that has links to Java3D 1.6 but I don't see a link to Java3D 1.7?  

Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

DonPearson
In reply to this post by gouessej
BTW, I did find the 3 jar files in:  https://jogamp.org/deployment/java3d/1.7.0-pre1/   So perhaps you might just want to update your thread to point to that location?   Anyway, I did download the 3 updated jar files and switch them out with the 1.6 versions that I had, and still got the same result regarding mouse behavior.  

Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

gouessej
Administrator
Some developers stick with Java3D 1.6 because they don't want to modify the imports in their source code. Note that Java3D 1.7 is mentioned above. Thanks, I'm going to update the guide.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

philjord
Hi, I'm Phil the main developer of JAva3D. I've looked into this and for the life of me I can't get a middle mouse button to register a drag on a component no matter what JDK I use, below is my code.

So I guess whatever was registering your middle mouse button (and the loss of it) is something specific to the JVM and JDK you are using. Sorry I can't be more help here.

The EventCatcher will only fire on a mouse motion drag event and the MouseZoom requires the alt key to be pressed at the same time, so perhaps some flavors of Linux pass this as a mouse middle button drag event, and the MouseZoom was being helpful.

public static SimpleUniverse createUniverse() {
                GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
                Canvas3D c = new Canvas3D(config);
                SimpleUniverse univ = new SimpleUniverse(c);
                univ.getViewingPlatform().setNominalViewingTransform();
                univ.getViewer().getView().setMinimumFrameCycleTime(5);
               
               
               
                MouseMotionListener mml = new MouseMotionListener() {

                        @Override
                        public void mouseDragged(MouseEvent e) {
                                System.out.println("my one! " + e);
                               
                        }

                        @Override
                        public void mouseMoved(MouseEvent e) {
                                // TODO Auto-generated method stub
                               
                        }
                       
                };
               
                c.addMouseMotionListener(mml);
                return univ;
        }
Don
Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

Don
Thanks Phil for looking into this.     I am not a professional programmer -- just dabble every now and then with Java,  I havenn't had time to set up your code below for my system, but may be able to do so one of these days.   In the meantime, I wanted to give you more info about my current code situation.   See below:


Platform: Windows 10
Development environment: Netbeans 11
Mouse: 3 button.  Middle button can be depressed and also scrolls (it is really a wheel).

a. JDK 1.8:  Scrolling (rotating) with middle button does nothing, but one can depress the middle button and then translate it to get the desired zooming behavior.  The portion of the code below that successfully performed this functionality is currently commented out below but shown for awareness – to show what was successful with JDK1.8.  This is the functionality that I wanted.

b. JDK11 :  Using the code exactly as shown below, depressing middle button causes same functionality as use of left button (and also right button has same functionality).   I really didn’t want all 3 buttons performing the same function.  But by scrolling the middle button, instead of depressing it,  I can get desired zoom behavior, but not as smoothly.


CODE FOLLOWS:

private void setupMouseBehavior()
  {
    //we want these mouse actions to work over the following
    //100km bounding sphere:
    BoundingSphere bs = new BoundingSphere(new Point3d(),
                                 (float)StarChart3Dpanel.MAX_DIST);

    //Set up the RA panning behavior around TG1.
    MouseRotate mouseRot = new MouseRotate();
    mouseRot.setTransformGroup(tg1);
    mouseRot.setSchedulingBounds(bs);
    tg1.addChild(mouseRot);
    mouseRot.setFactor(0.003,0.0); //turns off vertical motion of button

    //Set up the DEC panning behavior around TG2.
    MouseRotate mouseRot2 = new MouseRotate();
    mouseRot2.setTransformGroup(tg2);
    mouseRot2.setSchedulingBounds(bs);
    tg2.addChild(mouseRot2);
    mouseRot2.setFactor(0.00,0.003); //turns off horizontal motion of button

    /* Don't allow this.  We want to use the right mouse button for popups
    MouseTranslate mouseTrn = new MouseTranslate();
    mouseTrn.setTransformGroup(tg1);
    mouseTrn.setSchedulingBounds(bs);
    tg1.addChild(mouseTrn);
    mouseTrn.setFactor(0.02);  //default is 0.02  THIS IS THE RIGHT BUTTON
    */
   
   
    //   -------------------------------------------------------------  
   
   
    /**
    //  NOTE: this works with Java 1.8 and earlier, but not Java 11.
    //Set up ZOOMing behavior around TG3.
    MouseZoom mouseZoom = new MouseZoom(); //CENTER BUTTON (or ALT-leftButton)
    mouseZoom.setTransformGroup(tg3);
    mouseZoom.setSchedulingBounds(bs);
    tg3.addChild(mouseZoom);
    mouseZoom.setFactor(0.001);
    //System.out.println("mouseZoom");
    * */
   
   
   
    // The following works with Java 11:, but is not as easy to use as above.
    //Ease of use can be fixed by changing 0.001 to a different value.
    MouseWheelZoom mwz = new MouseWheelZoom();
    mwz.setTransformGroup(tg3);
    mwz.setSchedulingBounds(bs);
    tg3.addChild(mwz);
    mwz.setFactor(0.01);
   
    //  --------------------------------------------------------------
   
  }
Don
Reply | Threaded
Open this post in threaded view
|

Re: Java3D bug using JDK11

Don
In reply to this post by philjord
I also have a separate but somewhat related question -- is there any intent to release Java3D as a module?   As you know, there is a push to go modular and not need JREs.   My other homebrewed software is now modular, but I can't step up to making a couple of my applications(which required java3D) standalone apps without a modular java3D.