diff options
author | Sven Gothel <[email protected]> | 2011-02-26 22:41:04 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-26 22:41:04 +0100 |
commit | 10c696f7e908ccbf150838f86b286b7c383058c6 (patch) | |
tree | c39fb70e8223ae86be61c4926fdf4c91a6734c73 /src/newt/classes/com | |
parent | 76444dce2b678a7f6769564abac4f8a73f414609 (diff) |
Code cleanup: override, imports, StringBuilder, ..
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 11 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 16 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 9154ab7d8..0eda5c2a3 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -113,6 +113,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto FocusAction focusAction = new FocusAction(); WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() { + @Override public void windowGainedFocus(WindowEvent arg0) { MenuSelectionManager.defaultManager().clearSelectedPath(); } @@ -173,6 +174,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void addNotify() { // before native peer is valid: X11 @@ -194,6 +196,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto reparentWindow(true, cont); } + @Override public void removeNotify() { java.awt.Container cont = AWTMisc.getContainer(this); if(DEBUG) { @@ -262,12 +265,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void paint(Graphics g) { awtWindowClosingProtocol.addClosingListenerOneShot(); if(null!=newtChild) { newtChild.windowRepaint(0, 0, getWidth(), getHeight()); } } + @Override public void update(Graphics g) { awtWindowClosingProtocol.addClosingListenerOneShot(); if(null!=newtChild) { @@ -287,11 +292,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void requestFocus() { requestFocusAWTParent(); requestFocusNEWTChild(); } + @Override public boolean requestFocus(boolean temporary) { boolean res = super.requestFocus(temporary); if(res) { @@ -300,6 +307,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return res; } + @Override public boolean requestFocusInWindow() { boolean res = super.requestFocusInWindow(); if(res) { @@ -308,6 +316,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return res; } + @Override public boolean requestFocusInWindow(boolean temporary) { boolean res = super.requestFocusInWindow(temporary); if(res) { @@ -358,8 +367,6 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); } catch (Exception e) { - // FIXME: workaround for 6504460 (incorrect backport of 6333613 in 5.0u10) - // throw new GLException(e); t = e; } if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index fee188768..5eec746a8 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -75,12 +75,14 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { this.window = (WindowImpl) window; ((WindowImpl)this.window).setHandleDestroyNotify(false); window.addWindowListener(new WindowAdapter() { + @Override public void windowRepaint(WindowUpdateEvent e) { if( !GLWindow.this.window.isWindowLockedByOtherThread() && !GLWindow.this.helper.isExternalAnimatorAnimating() ) { display(); } } + @Override public void windowResized(WindowEvent e) { sendReshape = true; if( !GLWindow.this.window.isWindowLockedByOtherThread() && !GLWindow.this.helper.isExternalAnimatorAnimating() ) { @@ -88,6 +90,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { } } + @Override public void windowDestroyNotify(WindowEvent e) { if( DISPOSE_ON_CLOSE == GLWindow.this.getDefaultCloseOperation() ) { // Is an animator thread perform rendering? @@ -248,6 +251,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { return window.isVisible(); } + @Override public final String toString() { return "NEWT-GLWindow[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable + ", \n\tContext: " + context + /** ", \n\tWindow: "+window+", \n\tFactory: "+factory+ */ "]"; @@ -314,7 +318,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void destroyActionInLock() { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.destroy() "+Thread.currentThread()+", start"); + String msg = "GLWindow.destroy() "+Thread.currentThread()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -343,7 +347,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void invalidate(boolean unrecoverable) { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.invalidate("+unrecoverable+") "+Thread.currentThread()+", start"); + String msg = "GLWindow.invalidate("+unrecoverable+") "+Thread.currentThread()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -366,7 +370,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void setVisibleActionPost(boolean visible, boolean nativeWindowCreated) { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start"); + String msg = "GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start"; System.err.println(msg); // Exception e1 = new Exception(msg); // e1.printStackTrace(); @@ -393,7 +397,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { context = drawable.createContext(sharedContext); } if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin"); + String msg = "GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -648,7 +652,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { } /** Reset all counter (startTime, currentTime, frame number) */ - public synchronized void resetCounter() { + public final synchronized void resetCounter() { startTime = System.currentTimeMillis(); // overwrite startTime to real init one curTime = startTime; lastCheck = startTime; @@ -914,7 +918,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { glWindow.addGLEventListener(new GLEventListener() { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println(JoglVersion.getInstance().getGLInfo(gl, null)); + System.err.println(JoglVersion.getGLInfo(gl, null)); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { |