diff options
author | Sven Gothel <[email protected]> | 2011-10-29 15:12:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-29 15:12:28 +0200 |
commit | cf7851ba926c099f4a63dc621f66b2c839df73ea (patch) | |
tree | 6e6c3622c2d50274dfa3d40ea2b62c360c5e98c1 | |
parent | 64b8a2ac494ec1a63500bd4dbab2738fd00bd48c (diff) |
NEWT/Applet: Add 'newt.debug.Applet' ; Be more verbose in DEBUG Mode;
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 49 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 4 |
2 files changed, 51 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index 38a3d952d..2e86cb512 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -1,7 +1,9 @@ package com.jogamp.newt.awt.applet; import java.applet.*; +import java.awt.Component; import java.awt.Container; +import java.awt.Label; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.KeyListener; @@ -12,6 +14,8 @@ import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; import java.awt.BorderLayout; +import jogamp.newt.Debug; + /** * Simple GLEventListener deployment as an applet using JOGL. This demo must be * referenced from a web page via an <applet> tag. @@ -58,6 +62,8 @@ import java.awt.BorderLayout; */ @SuppressWarnings("serial") public class JOGLNewtApplet1Run extends Applet { + public static final boolean DEBUG = Debug.debug("Applet"); + GLWindow glWindow; NewtCanvasAWT newtCanvasAWT; JOGLNewtAppletBase base; @@ -69,7 +75,7 @@ public class JOGLNewtApplet1Run extends Applet { if(!(this instanceof Container)) { throw new RuntimeException("This Applet is not a AWT Container"); } - Container container = (Container) this; // have to think about that, we may use a Container + Container container = (Container) this; String glEventListenerClazzName=null; String glProfileName=null; @@ -105,6 +111,24 @@ public class JOGLNewtApplet1Run extends Applet { throw new RuntimeException("No applet parameter 'gl_event_listener_class'"); } glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight; + if(DEBUG) { + System.err.println("JOGLNewtApplet1Run Configuration:"); + System.err.println("glStandalone: "+glStandalone); + if(glStandalone) { + System.err.println("pos-size: "+glXd+"/"+glYd+" "+glWidth+"x"+glHeight); + } + System.err.println("glEventListenerClazzName: "+glEventListenerClazzName); + System.err.println("glProfileName: "+glProfileName); + System.err.println("glSwapInterval: "+glSwapInterval); + System.err.println("glDebug: "+glDebug); + System.err.println("glTrace: "+glTrace); + System.err.println("glUndecorated: "+glUndecorated); + System.err.println("glAlwaysOnTop: "+glAlwaysOnTop); + System.err.println("glOpaque: "+glOpaque); + System.err.println("glAlphaBits: "+glAlphaBits); + System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer); + System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener); + } base = new JOGLNewtAppletBase(glEventListenerClazzName, glSwapInterval, @@ -132,6 +156,12 @@ public class JOGLNewtApplet1Run extends Applet { container.setLayout(new BorderLayout()); container.add(newtCanvasAWT, BorderLayout.CENTER); } + if(DEBUG) { + container.add(new Label("North"), BorderLayout.NORTH); + container.add(new Label("South"), BorderLayout.SOUTH); + container.add(new Label("East"), BorderLayout.EAST); + container.add(new Label("West"), BorderLayout.WEST); + } base.init(glWindow); if(base.isValid()) { GLEventListener glEventListener = base.getGLEventListener(); @@ -152,11 +182,26 @@ public class JOGLNewtApplet1Run extends Applet { } public void start() { + this.validate(); + this.setVisible(true); + + final java.awt.Point p0 = this.getLocationOnScreen(); if(glStandalone) { glWindow.setSize(glWidth, glHeight); - final java.awt.Point p0 = this.getLocationOnScreen(); glWindow.setPosition(p0.x+glXd, p0.y+glYd); } + if(DEBUG) { + Component topC = this; + while (null != topC.getParent()) { + topC = topC.getParent(); + } + System.err.println("TopComponent: "+topC.getLocation()+" rel, "+topC.getLocationOnScreen()+" screen, visible "+topC.isVisible()+", "+topC); + System.err.println("Applet Pos: "+this.getLocation()+" rel, "+p0+" screen, visible "+this.isVisible()+", "+this); + if(null != newtCanvasAWT) { + System.err.println("NewtCanvasAWT Pos: "+newtCanvasAWT.getLocation()+" rel, "+newtCanvasAWT.getLocationOnScreen()+" screen, visible "+newtCanvasAWT.isVisible()+", "+newtCanvasAWT); + } + System.err.println("GLWindow Pos: "+glWindow.getX()+"/"+glWindow.getY()+" rel, "+glWindow.getLocationOnScreen(null)+" screen"); + } base.start(); } diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java index c6240d1f9..b1061dd14 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -7,6 +7,8 @@ import java.security.PrivilegedAction; import javax.media.nativewindow.NativeWindow; import javax.media.opengl.*; +import jogamp.newt.Debug; + import com.jogamp.opengl.util.*; import com.jogamp.newt.event.*; @@ -16,6 +18,8 @@ import com.jogamp.newt.opengl.GLWindow; referenced from a web page via an <applet> tag. */ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { + public static final boolean DEBUG = Debug.debug("Applet"); + String glEventListenerClazzName; int glSwapInterval; boolean noDefaultKeyListener; |