From 36aaff888ce0fe773d89de89bdf79eb3d4b1c0bf Mon Sep 17 00:00:00 2001 From: eteq Date: Tue, 1 Aug 2006 20:49:36 +0000 Subject: updated to latest version of GLJFrame from previous source tree git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/joglutils/trunk@6 83d24430-9974-4f80-8418-2cc3294053b9 --- src/net/java/joglutils/GLJFrame.java | 61 ++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/src/net/java/joglutils/GLJFrame.java b/src/net/java/joglutils/GLJFrame.java index a76ab1e..bde29fc 100644 --- a/src/net/java/joglutils/GLJFrame.java +++ b/src/net/java/joglutils/GLJFrame.java @@ -47,9 +47,9 @@ import java.awt.event.*; * @author Erik J. Tollerud */ public class GLJFrame extends JFrame { - private Canvas mainCanvas; private GLEventListener listener; private GLCapabilities caps; + private GLCapabilitiesChooser chooser; private com.sun.opengl.util.Animator animator; private GLContext contextToShareWith; @@ -69,6 +69,7 @@ public class GLJFrame extends JFrame { super(title); this.listener = listener; this.caps = new GLCapabilities(); + this.chooser = null; //can be null because that will choose the default initComponents(); ((GLCanvas)mainCanvas).addGLEventListener(listener); animator = null; @@ -76,41 +77,54 @@ public class GLJFrame extends JFrame { } /** * Creates new form GLJFrame - * @param title title for the window + * @param caps the GLCapabilities to request for the GLCanvas + * @param chooser the capabilities chooser to use in creating the GLCanvas on this frame + * @param title the title for the window * @param listener the GLEventListener to attach to the GLCanvas - * @param capabilities the GLCapabilities to request for the GLCanvas + * @param contextToShareWith the context to share with */ - public GLJFrame(String title, GLEventListener listener, GLCapabilities capabilities) { + public GLJFrame(String title, GLEventListener listener, GLCapabilities caps,GLCapabilitiesChooser chooser,GLContext contextToShareWith) { super(title); this.listener = listener; - this.caps = (GLCapabilities)capabilities.clone(); + this.caps = caps; + this.chooser = chooser; + this.contextToShareWith = contextToShareWith; initComponents(); ((GLCanvas)mainCanvas).addGLEventListener(listener); animator = null; - this.contextToShareWith = null; } + /** * Creates new form GLJFrame + * @param title title for the window * @param listener the GLEventListener to attach to the GLCanvas - * @param contextToShareWith the context to share with - * @see javax.media.opengl.GLCanvas#javax.media.opengl.GLCanvas(javax.media.opengl.GLCapabilities,javax.media.opengl.GLCapabilitiesChooser,javax.media.opengl.GLContext,javax.media.opengl.GraphicsDevice) + * @param capabilities the GLCapabilities to request for the GLCanvas */ - public GLJFrame(GLEventListener listener, GLContext contextToShareWith) { - this(listener); - this.contextToShareWith = contextToShareWith; - + public GLJFrame(String title, GLEventListener listener, GLCapabilities capabilities) { + this(title,listener,capabilities,null,null); } + /** * Creates new form GLJFrame * @param title title for the window * @param listener the GLEventListener to attach to the GLCanvas * @param capabilities the GLCapabilities to request for the GLCanvas + * @param chooser the capabilities chooser to use in creating the GLCanvas on this frame + */ + public GLJFrame(String title, GLEventListener listener, GLCapabilities capabilities, GLCapabilitiesChooser chooser) { + this(title,listener,capabilities,chooser,null); + } + + /** + * Creates new form GLJFrame + * @param listener the GLEventListener to attach to the GLCanvas * @param contextToShareWith the context to share with * @see javax.media.opengl.GLCanvas#javax.media.opengl.GLCanvas(javax.media.opengl.GLCapabilities,javax.media.opengl.GLCapabilitiesChooser,javax.media.opengl.GLContext,javax.media.opengl.GraphicsDevice) */ - public GLJFrame(String title, GLEventListener listener, GLCapabilities capabilities, GLContext contextToShareWith) { - this(title,listener,capabilities); + public GLJFrame(GLEventListener listener, GLContext contextToShareWith) { + this(listener); this.contextToShareWith = contextToShareWith; + } /** * Creates new form GLJFrame @@ -163,9 +177,14 @@ public class GLJFrame extends JFrame { this.setFullscreen(fullscreen); } - + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents private void initComponents() { - mainCanvas = new GLCanvas(caps,null,contextToShareWith,null); + mainCanvas = new GLCanvas(caps,chooser,contextToShareWith,null); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); addComponentListener(new java.awt.event.ComponentAdapter() { @@ -178,13 +197,15 @@ public class GLJFrame extends JFrame { getContentPane().add(mainCanvas, java.awt.BorderLayout.CENTER); pack(); - } + }// //GEN-END:initComponents - private void formComponentResized(java.awt.event.ComponentEvent evt) { + private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized this.mainCanvas.setSize(this.getRootPane().getSize()); - } + }//GEN-LAST:event_formComponentResized - + // Variables declaration - do not modify//GEN-BEGIN:variables + private java.awt.Canvas mainCanvas; + // End of variables declaration//GEN-END:variables /** * Sets the event listener attached to the GLcanvas. Note that this method does not repaint this component, so it will not immediately update. * @param listener the GLEventListener to attach to the GLCanvas -- cgit v1.2.3