diff options
author | Kenneth Russel <[email protected]> | 2007-05-07 04:06:10 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-05-07 04:06:10 +0000 |
commit | e84d4b3c8c305c0c96663d8084a065526d1df018 (patch) | |
tree | c8b326d594d2e3df249251d1ef8df0766035f0a4 | |
parent | 0984fbbdd95f66d8f743163e7b17452742654c64 (diff) |
More changes to make GLCanvas work better in NetBeans GUI builder on
X11 platforms
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1237 232f8b59-042b-4e1e-8c03-345bb8c30851
-rw-r--r-- | src/classes/javax/media/opengl/GLCanvas.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/GLCanvas.java index 0f19b4aa2..c6bc10c3f 100644 --- a/src/classes/javax/media/opengl/GLCanvas.java +++ b/src/classes/javax/media/opengl/GLCanvas.java @@ -114,10 +114,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { // least in the Sun AWT implementation) that this will result in // equivalent behavior to calling the no-arg super() constructor // for Canvas. - super(unwrap((AWTGraphicsConfiguration) - GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, - chooser, - new AWTGraphicsDevice(device)))); + super(chooseGraphicsConfiguration(capabilities, chooser, device)); if (!Beans.isDesignTime()) { drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser); context = (GLContextImpl) drawable.createContext(shareWith); @@ -401,10 +398,22 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } } - private static GraphicsConfiguration unwrap(AWTGraphicsConfiguration config) { + private static GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GraphicsDevice device) { + // Make GLCanvas behave better in NetBeans GUI builder + if (Beans.isDesignTime()) { + return null; + } + + AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) + GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, + chooser, + new AWTGraphicsDevice(device)); if (config == null) { return null; } + return config.getGraphicsConfiguration(); } } |