Re: Mac Canvas3D location bug
Posted by
Manu on
Oct 05, 2013; 12:34pm
URL: https://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4030158.html
The canvas 3D is placed correctly in a frame now, but is misplaced in a child dialog.
This can be tested with the simple following example where the canvas 3D doesn't appear at the good location:
import java.awt.GraphicsEnvironment;
import javax.media.j3d.*;
import javax.swing.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
public class Canvas3DPositionInDialogTest {
public static void main(String [] args) {
// Create a minimal canvas 3D
GraphicsConfigTemplate3D gc = new GraphicsConfigTemplate3D();
Canvas3D canvas = new Canvas3D(GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getBestConfiguration(gc));
canvas.setSize(100, 100);
new SimpleUniverse(canvas);
// Display the canvas 3D in a dialog child of a frame
JFrame frame = new JFrame("Canvas3DPositionTest");
frame.setSize(400, 400);
frame.setVisible(true);
JOptionPane.showMessageDialog(frame, canvas);
}
}
I think that when you look for the location of the canvas 3D at screen, you should go up in the components hierarchy until you find a parent of Window class, and not until you get a null parent. Hope this will help...
Did you have the chance to look at the other issue I reported in the Canvas3DVisibilityTest class?
Emmanuel Puybaret