From e84d4b3c8c305c0c96663d8084a065526d1df018 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 7 May 2007 04:06:10 +0000 Subject: 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 --- src/classes/javax/media/opengl/GLCanvas.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') 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(); } } -- cgit v1.2.3