From 10c696f7e908ccbf150838f86b286b7c383058c6 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sat, 26 Feb 2011 22:41:04 +0100
Subject: Code cleanup: override, imports, StringBuilder, ..
---
.../classes/javax/media/opengl/awt/GLCanvas.java | 27 ++++++++++++++--------
.../classes/jogamp/opengl/GLDrawableHelper.java | 9 ++++----
2 files changed, 22 insertions(+), 14 deletions(-)
(limited to 'src/jogl')
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index b7ec1ec1a..78038500e 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -242,6 +242,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* Overridden to choose a GraphicsConfiguration on a parent container's
* GraphicsDevice because both devices
*/
+ @Override
public GraphicsConfiguration getGraphicsConfiguration() {
/*
* Workaround for problems with Xinerama and java.awt.Component.checkGD
@@ -457,6 +458,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
Overrides:
paint
in class java.awt.Component
*/
+ @Override
public void paint(Graphics g) {
if (Beans.isDesignTime()) {
// Make GLCanvas behave better in NetBeans GUI builder
@@ -492,6 +494,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
Overrides:
addNotify
in class java.awt.Component
*/
+ @Override
public void addNotify() {
if(DEBUG) {
Exception ex1 = new Exception(Thread.currentThread().getName()+" - Info: addNotify - start, bounds: "+this.getBounds());
@@ -576,6 +579,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
about this.
Overrides:
removeNotify
in class java.awt.Component
*/
+ @Override
public void removeNotify() {
if(DEBUG) {
Exception ex1 = new Exception(Thread.currentThread().getName()+" - Info: removeNotify - start");
@@ -610,6 +614,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
Overrides:
reshape
in class java.awt.Component
*/
+ @Override
public void reshape(int x, int y, int width, int height) {
super.reshape(x, y, width, height);
sendReshape = true;
@@ -617,8 +622,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Overrides:
update
in class java.awt.Component
*/
- // Overridden from Canvas to prevent the AWT's clearing of the
- // canvas from interfering with the OpenGL rendering.
+ /**
+ * Overridden from Canvas to prevent the AWT's clearing of the
+ * canvas from interfering with the OpenGL rendering.
+ */
+ @Override
public void update(Graphics g) {
paint(g);
}
@@ -659,14 +667,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if (Beans.isDesignTime()) {
return null;
}
- GLContext context = getContext();
- return (context == null) ? null : context.getGL();
+ GLContext ctx = getContext();
+ return (ctx == null) ? null : ctx.getGL();
}
public GL setGL(GL gl) {
- GLContext context = getContext();
- if (context != null) {
- context.setGL(gl);
+ GLContext ctx = getContext();
+ if (ctx != null) {
+ ctx.setGL(gl);
return gl;
}
return null;
@@ -732,6 +740,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
+ @Override
public String toString() {
return "AWT-GLCanvas[ "+awtConfig+", "+((null!=drawable)?drawable.getClass().getName():"null-drawable")+"]";
}
@@ -922,8 +931,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
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) {
@@ -1013,7 +1020,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
glCanvas.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) {
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index fe2b374a0..d079a1bd1 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -75,8 +75,9 @@ public class GLDrawableHelper {
animatorCtrl = null;
}
+ @Override
public final String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("GLAnimatorControl: "+animatorCtrl+", ");
synchronized(listenersLock) {
sb.append("GLEventListeners num "+listeners.size()+" [");
@@ -149,7 +150,7 @@ public class GLDrawableHelper {
}
}
- private final boolean init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape) {
+ private boolean init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape) {
if(listenersToBeInit.remove(l)) {
l.init(drawable);
if(sendReshape) {
@@ -194,7 +195,7 @@ public class GLDrawableHelper {
execGLRunnables(drawable);
}
- private final void reshape(GLEventListener listener, GLAutoDrawable drawable,
+ private void reshape(GLEventListener listener, GLAutoDrawable drawable,
int x, int y, int width, int height, boolean setViewport) {
if(setViewport) {
drawable.getGL().glViewport(x, y, width, height);
@@ -212,7 +213,7 @@ public class GLDrawableHelper {
}
}
- private final void execGLRunnables(GLAutoDrawable drawable) {
+ private void execGLRunnables(GLAutoDrawable drawable) {
if(glRunnables.size()>0) {
// swap one-shot list asap
ArrayList _glRunnables = null;
--
cgit v1.2.3