aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-05-06 01:24:55 +0000
committerKenneth Russel <[email protected]>2007-05-06 01:24:55 +0000
commit6befcf9f2988e8e5f4955e02f52fb5a693c692a9 (patch)
tree015eee56375d7ba714410311a197b0a296ee9a13 /src
parent1204b255cd54a8dd2ca3e2a76d144c25046c5ca5 (diff)
More changes to make the GLCanvas work more reliably in the NetBeans
GUI builder git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1235 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r--src/classes/javax/media/opengl/GLCanvas.java68
1 files changed, 41 insertions, 27 deletions
diff --git a/src/classes/javax/media/opengl/GLCanvas.java b/src/classes/javax/media/opengl/GLCanvas.java
index 4c39f912e..0f19b4aa2 100644
--- a/src/classes/javax/media/opengl/GLCanvas.java
+++ b/src/classes/javax/media/opengl/GLCanvas.java
@@ -118,9 +118,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities,
chooser,
new AWTGraphicsDevice(device))));
- drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser);
- context = (GLContextImpl) drawable.createContext(shareWith);
- context.setSynchronized(true);
+ if (!Beans.isDesignTime()) {
+ drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, chooser);
+ context = (GLContextImpl) drawable.createContext(shareWith);
+ context.setSynchronized(true);
+ }
}
public GLContext createContext(GLContext shareWith) {
@@ -176,8 +178,10 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
<DL><DD><CODE>addNotify</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */
public void addNotify() {
super.addNotify();
- disableBackgroundErase();
- drawable.setRealized(true);
+ if (!Beans.isDesignTime()) {
+ disableBackgroundErase();
+ drawable.setRealized(true);
+ }
if (DEBUG) {
System.err.println("GLCanvas.addNotify()");
}
@@ -191,29 +195,33 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
<B>Overrides:</B>
<DL><DD><CODE>removeNotify</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */
public void removeNotify() {
- try {
- if (Threading.isSingleThreaded() &&
- !Threading.isOpenGLThread()) {
- // Workaround for termination issues with applets --
- // sun.applet.AppletPanel should probably be performing the
- // remove() call on the EDT rather than on its own thread
- if (Threading.isAWTMode() &&
- Thread.holdsLock(getTreeLock())) {
- // The user really should not be invoking remove() from this
- // thread -- but since he/she is, we can not go over to the
- // EDT at this point. Try to destroy the context from here.
- destroyAction.run();
+ if (Beans.isDesignTime()) {
+ super.removeNotify();
+ } else {
+ try {
+ if (Threading.isSingleThreaded() &&
+ !Threading.isOpenGLThread()) {
+ // Workaround for termination issues with applets --
+ // sun.applet.AppletPanel should probably be performing the
+ // remove() call on the EDT rather than on its own thread
+ if (Threading.isAWTMode() &&
+ Thread.holdsLock(getTreeLock())) {
+ // The user really should not be invoking remove() from this
+ // thread -- but since he/she is, we can not go over to the
+ // EDT at this point. Try to destroy the context from here.
+ destroyAction.run();
+ } else {
+ Threading.invokeOnOpenGLThread(destroyAction);
+ }
} else {
- Threading.invokeOnOpenGLThread(destroyAction);
+ destroyAction.run();
+ }
+ } finally {
+ drawable.setRealized(false);
+ super.removeNotify();
+ if (DEBUG) {
+ System.err.println("GLCanvas.removeNotify()");
}
- } else {
- destroyAction.run();
- }
- } finally {
- drawable.setRealized(false);
- super.removeNotify();
- if (DEBUG) {
- System.err.println("GLCanvas.removeNotify()");
}
}
}
@@ -251,11 +259,17 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
public GL getGL() {
+ if (Beans.isDesignTime()) {
+ return null;
+ }
+
return getContext().getGL();
}
public void setGL(GL gl) {
- getContext().setGL(gl);
+ if (!Beans.isDesignTime()) {
+ getContext().setGL(gl);
+ }
}
public void setAutoSwapBufferMode(boolean onOrOff) {