aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-04 01:58:32 +0100
committerSven Gothel <[email protected]>2010-11-04 01:58:32 +0100
commit4d56491c3f8e76676e1c860d018bbe991d28ebac (patch)
treef5d9a7f61614b94ad3dd81fc55e323e2f9fed4e0 /src
parenta0e9d6c8382b7275db6fae664be44db6b59671d5 (diff)
Seperated unit tests (newt/awt/headless) and cleaned up some imports and comments
Seperated unit tests (newt/awt/headless) - no more *CORE* tests - junit.run.newt.headless: all NEWT headless (no-AWT) tests, without any AWT classes and with -Djava.awt.headless=true. Disabled for 'isOSX'. - junit.run.newt: all NEWT non AWT tests (same as above), but with full AWT. This test is not enabled via junit.run. Disabled for 'isOSX'. - junit.run.awt: all AWT tests without NEWT - using newt.event.jar to add AWT agnostic NEWT event adapter - junit.run.newt.awt: all NEWT + AWT tests - junit.run: junit.run.newt.headless,junit.run.awt,junit.run.newt.awt - swizzling around a few tests to achieve the above: TEST rules: - A runnable unit test must start with 'Test' - Only pure NEWT tests must have 'NEWT' in their name - AWT tests must have 'AWT' in their name. - AWT + NEWT tests must have '.newt.' in their package name, hence - Pure AWT tests (without NEWT) must not have '.newt.' in their package name
Diffstat (limited to 'src')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java65
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java)16
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java)3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java (renamed from src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java)2
-rw-r--r--src/junit/com/jogamp/test/junit/util/DumpVersion.java (renamed from src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java)2
-rw-r--r--src/junit/com/jogamp/test/junit/util/QuitAdapter.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java)4
-rw-r--r--src/newt/classes/com/jogamp/newt/event/InputEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyAdapter.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/KeyListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/MouseListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEvent.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java1
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowEvent.java3
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowListener.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java73
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java9
26 files changed, 88 insertions, 129 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
index e6988582c..0c64cfdf2 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -29,6 +29,7 @@
package com.jogamp.test.junit.jogl.acore;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.DumpVersion;
import org.junit.Assert;
import org.junit.Before;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
index d0f915e03..d9194c216 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
@@ -2,18 +2,14 @@
package com.jogamp.test.junit.jogl.demos.gl2.gears;
import javax.media.opengl.*;
-import javax.media.opengl.awt.*;
-import com.jogamp.opengl.util.Animator;
+
import com.jogamp.newt.event.*;
import com.jogamp.newt.event.awt.*;
-
-import java.awt.Component;
-import java.awt.Frame;
import com.jogamp.newt.Window;
/**
* Gears.java <BR>
- * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P>
+ * author: Brian Paul (converted to Java by Ron Cemer and Sven Gothel) <P>
*
* This version is equal to Brian Paul's version 1.2 1999/10/21
*/
@@ -24,8 +20,8 @@ public class Gears implements GLEventListener {
private float angle = 0.0f;
private int swapInterval;
- private int prevMouseX, prevMouseY;
private boolean mouseRButtonDown = false;
+ private int prevMouseX, prevMouseY;
public Gears(int swapInterval) {
this.swapInterval = swapInterval;
@@ -35,42 +31,6 @@ public class Gears implements GLEventListener {
this.swapInterval = 1;
}
- public static void main(String[] args) {
- // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
- // <application-desc main-class="demos.j2d.TextCube"/>
- // <argument>NotFirstUIActionOnProcess</argument>
- // </application-desc>
- boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ;
- GLProfile.initSingleton(firstUIActionOnProcess);
-
- Frame frame = new Frame("Gear Demo");
- GLCanvas canvas = new GLCanvas();
- // GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
- // GLCanvas canvas = new GLCanvas(caps);
-
- final Gears gears = new Gears();
- canvas.addGLEventListener(gears);
-
- frame.add(canvas);
- frame.setSize(300, 300);
- final Animator animator = new Animator(canvas);
- frame.addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent e) {
- // Run this on another thread than the AWT event queue to
- // make sure the call to Animator.stop() completes before
- // exiting
- new Thread(new Runnable() {
- public void run() {
- animator.stop();
- System.exit(0);
- }
- }).start();
- }
- });
- frame.setVisible(true);
- animator.start();
- }
-
public void init(GLAutoDrawable drawable) {
System.err.println("Gears: Init");
// Use debug pipeline
@@ -113,12 +73,12 @@ public class Gears implements GLEventListener {
// MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
MouseListener gearsMouse = new GearsMouseAdapter();
- if (drawable instanceof Component) {
- Component comp = (Component) drawable;
- new AWTMouseAdapter(gearsMouse).addTo(comp);
- } else if (drawable instanceof Window) {
+ if (drawable instanceof Window) {
Window window = (Window) drawable;
window.addMouseListener(gearsMouse);
+ } else if (GLProfile.isAWTAvailable() && drawable instanceof java.awt.Component) {
+ java.awt.Component comp = (java.awt.Component) drawable;
+ new AWTMouseAdapter(gearsMouse).addTo(comp);
}
}
@@ -154,9 +114,10 @@ public class Gears implements GLEventListener {
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
- if ((drawable instanceof GLJPanel) &&
- !((GLJPanel) drawable).isOpaque() &&
- ((GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
+ if (GLProfile.isAWTAvailable() &&
+ (drawable instanceof javax.media.opengl.awt.GLJPanel) &&
+ !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() &&
+ ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
} else {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
@@ -335,8 +296,8 @@ public class Gears implements GLEventListener {
Window window = (Window) source;
width=window.getWidth();
height=window.getHeight();
- } else if (source instanceof Component) {
- Component comp = (Component) source;
+ } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
+ java.awt.Component comp = (java.awt.Component) source;
width=comp.getWidth();
height=comp.getHeight();
} else {
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
index 60435cb4a..9639c384b 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
@@ -37,6 +37,7 @@ import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.QuitAdapter;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import java.awt.Frame;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java
index 1589be84c..f88d4d16f 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java
@@ -26,23 +26,25 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.jogl.demos.gl2.gears.newt;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.QuitAdapter;
-import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-import com.jogamp.newt.*;
-import com.jogamp.newt.event.*;
-import com.jogamp.newt.opengl.*;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLRunnable;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
-import org.junit.After;
import org.junit.Test;
public class TestGearsNEWT extends UITestCase {
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java
index be1e5a58b..c965d5c21 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java
@@ -26,13 +26,14 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.jogl.demos.gl2.gears.newt;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.QuitAdapter;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index 326a6942a..79d899b6c 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.awt;
+package com.jogamp.test.junit.jogl.newt;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.test.junit.util.*;
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java b/src/junit/com/jogamp/test/junit/util/DumpVersion.java
index 3fa7f111f..df07c5bcf 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java
+++ b/src/junit/com/jogamp/test/junit/util/DumpVersion.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.acore;
+package com.jogamp.test.junit.util;
import org.junit.Assert;
import org.junit.Before;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java b/src/junit/com/jogamp/test/junit/util/QuitAdapter.java
index e60543b7c..258132582 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/QuitAdapter.java
@@ -26,12 +26,12 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.util;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.event.*;
-class QuitAdapter extends WindowAdapter implements WindowListener, KeyListener {
+public class QuitAdapter extends WindowAdapter implements WindowListener, KeyListener {
boolean shouldQuit = false;
public boolean shouldQuit() { return shouldQuit; }
diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
index d014de7f3..148787845 100644
--- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class InputEvent extends NEWTEvent
{
public static final int SHIFT_MASK = 1 << 0;
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
index 9fb208649..93c8409b1 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
@@ -1,5 +1,6 @@
/**
* Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -28,8 +29,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class KeyAdapter implements KeyListener
{
public void keyPressed(KeyEvent e) {
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
index f5ade47d8..852f77fcb 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class KeyEvent extends InputEvent
{
public KeyEvent(int eventType, Object source, long when, int modifiers, int keyCode, char keyChar) {
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyListener.java b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
index 5ce3868f5..dae343d80 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface KeyListener extends NEWTEventListener
{
public void keyPressed(KeyEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
index 7e04bc114..3607ae634 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class MouseAdapter implements MouseListener
{
public void mouseClicked(MouseEvent e) {
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index 705f558b9..fbe32d41d 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class MouseEvent extends InputEvent
{
public static final int BUTTON1 = 1;
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
index b328aeac7..5ec086b94 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface MouseListener extends NEWTEventListener
{
public void mouseClicked(MouseEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index 61858b083..10673be3d 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,9 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-import java.util.*;
-
/**
* NEWT events are provided for notification purposes ONLY;<br>
* The NEWT will automatically handle the event semantics internally, regardless of whether a program is receiving these events or not.<br>
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
index 4aa17bc02..fe224bba6 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
@@ -28,7 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
import java.util.LinkedList;
public class NEWTEventFiFo
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
index 90d00383d..677136573 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface NEWTEventListener extends java.util.EventListener
{
}
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
index 17d8df80b..14ee633a0 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class TraceMouseAdapter implements MouseListener {
MouseListener downstream;
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
index 3545a42d4..88b165a8d 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public class TraceWindowAdapter implements WindowListener {
WindowListener downstream;
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
index e57138c54..a1ad43a13 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public abstract class WindowAdapter implements WindowListener
{
public void windowResized(WindowEvent e) {
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
index 5221b3664..2742e0d95 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
/**
* NEWT Window events are provided for notification purposes ONLY.<br>
* NEWT will automatically handle component moves and resizes internally, regardless of whether a program is receiving these events or not. <br>
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index 174d4a414..0d201a2a4 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -34,8 +34,6 @@
package com.jogamp.newt.event;
-import com.jogamp.newt.*;
-
public interface WindowListener extends NEWTEventListener {
/** Window is resized, your application shall respect the new window dimension. A repaint is recommended. */
public void windowResized(WindowEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index c7b4f7b84..c136946ac 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -28,13 +28,12 @@
package com.jogamp.newt.event.awt;
-import com.jogamp.newt.util.EDTUtil;
import com.jogamp.newt.impl.Debug;
/**
* Convenient adapter forwarding AWT events to NEWT via the event listener model.<br>
* <p>
- * You may attach an instance of this adapter to an AWT Component. When an event happen,
+ * You may attach an instance of this adapter to an AWT Component. When an event happens,
* it is converted to a NEWT event and the given NEWT listener is being called.<br></p>
* <p>
* This adapter fullfills three use cases. First as a plain utility to write code AWT agnostic,
@@ -47,56 +46,68 @@ import com.jogamp.newt.impl.Debug;
* or to an AWT component, e.g. {@link java.awt.Component}.<br></p>
* <p>
* Common:<br>
- * <code>
- javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;<br>
- com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
- * </code> </p>
+ * <pre>
+ // your demo/render code
+ javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
+
+ // your AWT agnostic NEWT mouse listener code
+ com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
+ * </pre> </p>
* <p>
- * NEWT Usage:<br>
- * <code>
- GLWindow glWindow = GLWindow.create();<br>
- glWindow.addGLEventListener(demo1);<br>
- glWindow.addMouseListener(mouseListener);<br>
- * </code> </p>
+ * Default NEWT use case, without using the AWTAdapter:<br>
+ * <pre>
+ // the NEWT GLAutoDrawable and Window
+ GLWindow glWindow = GLWindow.create();
+
+ // attach the renderer demo1
+ glWindow.addGLEventListener(demo1);
+
+ // attach the NEWT mouse event listener to glWindow
+ glWindow.addMouseListener(mouseListener);
+ * </pre> </p>
* <p>
- * AWT Usage:<br>
- * <code>
- GLCanvas glCanvas = new GLCanvas();<br>
- glCanvas.addGLEventListener(demo1);<br>
- <br>
- new AWTMouseAdapter(mouseListener).addTo(glCanvas);<br>
- * </code> </p>
+ * AWT use case, AWTAdapter used as an AWT event translator and forwarder to your NEWT listener:<br>
+ * <pre>
+ // the AWT GLAutoDrawable and Canvas
+ GLCanvas glCanvas = new GLCanvas();
+
+ // attach the renderer demo1
+ glCanvas.addGLEventListener(demo1);
+
+ // attach the AWTMouseAdapter to glCanvas, which translates and forwards events to the NEWT mouseListener
+ new AWTMouseAdapter(mouseListener).addTo(glCanvas);
+ * </pre> </p>
* <p>
- * AWT Usage (previous form in detail):<br>
- * <code>
- AWTMouseAdapter mouseAdapter = new AWTMouseAdapter(mouseListener);<br>
- glCanvas.addMouseListener(mouseAdapter);<br>
- glCanvas.addMouseMotionListener(mouseAdapter);<br>
- * </code> </p>
+ * Previous code in detail:<br>
+ * <pre>
+ AWTMouseAdapter mouseAdapter = new AWTMouseAdapter(mouseListener);
+ glCanvas.addMouseListener(mouseAdapter);
+ glCanvas.addMouseMotionListener(mouseAdapter);
+ * </pre> </p>
*
* <p>
- * Second is just a litte variation, where we pass a NEWT Window <br>
- * to impersonate as the source of the event.<br></p>
+ * Second use case is just a litte variation of the previous use case, where we pass a NEWT Window <br>
+ * to be used as the source of the event.<br></p>
* <p>
- * <code>
+ * <pre>
com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
Component comp = ... ; // the AWT component<br>
GLWindow glWindow = GLWindow.create(); // the NEWT component<br>
<br>
new AWTMouseAdapter(mouseListener, glWindow).addTo(comp);<br>
- * </code> </p>
+ * </pre> </p>
*
* Last but not least, the AWTAdapter maybe used as a general AWT event forwarder to NEWT.<br>
*
* <p>
- * <code>
+ * <pre>
com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;<br>
Component comp = ... ; // the AWT component<br>
GLWindow glWindow = GLWindow.create(); // the NEWT component<br>
glWindow.addMouseListener(mouseListener); // add the custom EventListener to the NEWT component<br>
<br>
new AWTMouseAdapter(glWindow).addTo(comp); // forward all AWT events to glWindow, as NEWT events<br>
- * </code> </p>
+ * </pre> </p>
*
* @see #attachTo
*/
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
index 44ad3586e..68f2b3e0f 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
@@ -28,8 +28,6 @@
package com.jogamp.newt.event.awt;
-import java.awt.KeyboardFocusManager;
-
/**
* Specialized parent/client adapter,
* where the NEWT child window really gets resized,
diff --git a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
index 0fdfd44fe..c5460ef40 100644
--- a/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/impl/DefaultEDTUtil.java
@@ -143,8 +143,13 @@ public class DefaultEDTUtil implements EDTUtil {
task.run();
wait = false; // running in same thread (EDT) -> no wait
if(stop && edt.tasks.size()>0) {
- Throwable t = new Throwable("Warning: EDT about (2) to stop, having remaining tasks: "+edt.tasks.size()+" - "+edt);
- t.printStackTrace();
+ String msg = "Warning: EDT about (2) to stop, having remaining tasks: "+edt.tasks.size()+" - "+edt;
+ if(DEBUG) {
+ Throwable t = new Throwable(msg);
+ t.printStackTrace();
+ } else {
+ System.err.println(msg);
+ }
}
} else {
synchronized(edt.tasks) {