Login  Register

Re: Mac Canvas3D location bug

Posted by Manu on Oct 07, 2013; 2:49pm
URL: https://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4030186.html

Sorry I mixed class names. Here's a better applet test case.
import java.awt.GraphicsEnvironment;
import javax.media.j3d.*;
import javax.swing.*;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class Canvas3DPositionAppletTest extends JApplet {
  public void init() {
    // Create a new canvas 3D
    GraphicsConfigTemplate3D gc = new GraphicsConfigTemplate3D();
    Canvas3D canvas = new Canvas3D(GraphicsEnvironment.getLocalGraphicsEnvironment().
        getDefaultScreenDevice().getBestConfiguration(gc));
    new SimpleUniverse(canvas);

    // Build a GUI where the canvas 3D is located at top right of the frame 
    // and can be resized with split panes dividers
    JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
        true, new JScrollPane(), canvas);
    horizontalSplitPane.setResizeWeight(0.5);
    JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
        true, horizontalSplitPane, new JScrollPane());    
    verticalSplitPane.setResizeWeight(0.5);
    JRootPane intermediateRootPane = new JRootPane();
    intermediateRootPane.setContentPane(verticalSplitPane);
    add(intermediateRootPane);
  }
}
It already bugs with Java 6 appletviewer run from the Eclipse IDE, so no need of an accompanying HTML file I guess.
Emmanuel Puybaret