diff options
author | phil <[email protected]> | 2016-12-07 18:51:21 +1300 |
---|---|---|
committer | phil <[email protected]> | 2016-12-07 18:51:21 +1300 |
commit | 4a98513bb186c3d3ad2c061eddb2e6716c3dc8e9 (patch) | |
tree | 297ec0ae2bf95ee2e1ea25ff3aed7fa9f4268b36 /src | |
parent | 108761138020854f0c06e20abb7b69437d4ad91d (diff) |
Enumeration swapped to typed Iterator
All Enumerations swapped and generic types added
Diffstat (limited to 'src')
21 files changed, 125 insertions, 76 deletions
diff --git a/src/main/java/org/jdesktop/j3d/examples/collision/CollisionDetector.java b/src/main/java/org/jdesktop/j3d/examples/collision/CollisionDetector.java index 5d25810..d041d71 100644 --- a/src/main/java/org/jdesktop/j3d/examples/collision/CollisionDetector.java +++ b/src/main/java/org/jdesktop/j3d/examples/collision/CollisionDetector.java @@ -44,12 +44,13 @@ package org.jdesktop.j3d.examples.collision; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Appearance; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.ColoringAttributes; import org.jogamp.java3d.Shape3D; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnCollisionEntry; import org.jogamp.java3d.WakeupOnCollisionExit; import org.jogamp.vecmath.Color3f; @@ -77,13 +78,15 @@ public class CollisionDetector extends Behavior { inCollision = false; } - public void initialize() { + @Override + public void initialize() { wEnter = new WakeupOnCollisionEntry(shape); wExit = new WakeupOnCollisionExit(shape); wakeupOn(wEnter); } - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { inCollision = !inCollision; if (inCollision) { diff --git a/src/main/java/org/jdesktop/j3d/examples/distort_glyph/DistortBehavior.java b/src/main/java/org/jdesktop/j3d/examples/distort_glyph/DistortBehavior.java index 3ba873f..a7fd9d0 100644 --- a/src/main/java/org/jdesktop/j3d/examples/distort_glyph/DistortBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/distort_glyph/DistortBehavior.java @@ -44,7 +44,7 @@ package org.jdesktop.j3d.examples.distort_glyph; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Appearance; import org.jogamp.java3d.Behavior; @@ -130,14 +130,16 @@ public class DistortBehavior extends Behavior { return m_InitialWakeupCondition; } - public void initialize() { + @Override + public void initialize() { // apply the initial WakeupCriterion wakeupOn(m_InitialWakeupCondition); } - public void processStimulus(Enumeration criteria) { - while (criteria.hasMoreElements()) { - WakeupCriterion wakeUp = (WakeupCriterion) criteria.nextElement(); + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { + while (criteria.hasNext()) { + WakeupCriterion wakeUp = criteria.next(); if (wakeUp instanceof WakeupOnElapsedTime) { } else { diff --git a/src/main/java/org/jdesktop/j3d/examples/dot3/Dot3Demo.java b/src/main/java/org/jdesktop/j3d/examples/dot3/Dot3Demo.java index abd2ff4..dada022 100644 --- a/src/main/java/org/jdesktop/j3d/examples/dot3/Dot3Demo.java +++ b/src/main/java/org/jdesktop/j3d/examples/dot3/Dot3Demo.java @@ -50,7 +50,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.image.BufferedImage; -import java.util.Enumeration; +import java.util.Iterator; import javax.swing.JFrame; import javax.swing.JPanel; @@ -74,6 +74,7 @@ import org.jogamp.java3d.Texture; import org.jogamp.java3d.Texture2D; import org.jogamp.java3d.TextureAttributes; import org.jogamp.java3d.TextureUnitState; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; import org.jogamp.java3d.utils.behaviors.vp.OrbitBehavior; import org.jogamp.java3d.utils.geometry.GeometryInfo; @@ -511,7 +512,8 @@ public class Dot3Demo extends JFrame { */ public static void main(String[] args) {System.setProperty("sun.awt.noerasebackground", "true"); javax.swing.SwingUtilities.invokeLater(new Runnable() { - public void run() { + @Override + public void run() { new Dot3Demo(); } }); @@ -529,11 +531,13 @@ public class Dot3Demo extends JFrame { setSchedulingBounds(bounds); } - public void initialize() { + @Override + public void initialize() { wakeupOn(wakeup); } - public void processStimulus(Enumeration e) { + @Override + public void processStimulus(Iterator<WakeupCriterion> e) { // check if there are a new light map ready to use if (ctrlPanel.hasTextureImageReady()) { updateLighMap(ctrlPanel.getTextureImage()); diff --git a/src/main/java/org/jdesktop/j3d/examples/four_by_four/PickDragBehavior.java b/src/main/java/org/jdesktop/j3d/examples/four_by_four/PickDragBehavior.java index 697e934..e29b5d3 100644 --- a/src/main/java/org/jdesktop/j3d/examples/four_by_four/PickDragBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/four_by_four/PickDragBehavior.java @@ -46,7 +46,7 @@ package org.jdesktop.j3d.examples.four_by_four; import java.awt.AWTEvent; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Appearance; import org.jogamp.java3d.Behavior; @@ -120,7 +120,8 @@ public class PickDragBehavior extends Behavior { parallel = true; } - public void initialize() { + @Override +public void initialize() { x = 0; y = 0; x_last = 0; @@ -137,14 +138,15 @@ public class PickDragBehavior extends Behavior { wakeupOn (mouseCriterion); } - public void processStimulus (Enumeration criteria) { + @Override +public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] event; int id; int dx, dy; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { event = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); for (int i=0; i<event.length; i++) { diff --git a/src/main/java/org/jdesktop/j3d/examples/fps_counter/FPSCounter.java b/src/main/java/org/jdesktop/j3d/examples/fps_counter/FPSCounter.java index fa57927..853a1c6 100644 --- a/src/main/java/org/jdesktop/j3d/examples/fps_counter/FPSCounter.java +++ b/src/main/java/org/jdesktop/j3d/examples/fps_counter/FPSCounter.java @@ -45,8 +45,10 @@ package org.jdesktop.j3d.examples.fps_counter; import java.text.NumberFormat; +import java.util.Iterator; import org.jogamp.java3d.Behavior; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; /** This behavior calculates the frame rate and average frame rate of a @@ -142,7 +144,8 @@ public class FPSCounter extends Behavior { /** * Called to init the behavior */ - public void initialize() { + @Override + public void initialize() { // Set the trigger for the behavior to wakeup on every frame rendered wakeupOn(FPSwakeup); } @@ -150,7 +153,8 @@ public class FPSCounter extends Behavior { /** * Called every time the behavior is activated */ - public void processStimulus(java.util.Enumeration critera) { + @Override + public void processStimulus(Iterator<WakeupCriterion> critera) { // Apply calibration algorithm to determine number of frames to // wait before computing frames per second. // sampleduration = 10000 -> to run test, pass for 10 seconds. diff --git a/src/main/java/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java b/src/main/java/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java index f9b784f..176d56a 100644 --- a/src/main/java/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java +++ b/src/main/java/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java @@ -49,7 +49,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import javax.swing.JOptionPane; @@ -289,9 +289,9 @@ public class ObjLoadGLSL extends javax.swing.JFrame { private void setShaderProgram(Group g, ShaderAppearance myApp) { - Enumeration e = g.getAllChildren(); - while (e.hasMoreElements()) { - Node n = (Node)(e.nextElement()); + Iterator<Node> e = g.getAllChildren(); + while (e.hasNext()) { + Node n = e.next(); if (n instanceof Group) { setShaderProgram((Group)n, myApp); } diff --git a/src/main/java/org/jdesktop/j3d/examples/morphing/MorphingBehavior.java b/src/main/java/org/jdesktop/j3d/examples/morphing/MorphingBehavior.java index 49520c2..ee0a68b 100644 --- a/src/main/java/org/jdesktop/j3d/examples/morphing/MorphingBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/morphing/MorphingBehavior.java @@ -44,11 +44,12 @@ package org.jdesktop.j3d.examples.morphing; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Morph; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; // User-defined morphing behavior class @@ -61,7 +62,8 @@ public class MorphingBehavior extends Behavior { WakeupOnElapsedFrames w = new WakeupOnElapsedFrames(0); // Override Behavior's initialize method to setup wakeup criteria - public void initialize() { + @Override + public void initialize() { alpha.setStartTime(System.currentTimeMillis()); // Establish initial wakeup criteria @@ -69,7 +71,8 @@ public class MorphingBehavior extends Behavior { } // Override Behavior's stimulus method to handle the event - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { // NOTE: This assumes 3 objects. It should be generalized to // "n" objects. diff --git a/src/main/java/org/jdesktop/j3d/examples/oriented_shape3d/MouseRotateY.java b/src/main/java/org/jdesktop/j3d/examples/oriented_shape3d/MouseRotateY.java index 473eaf7..05b1f2e 100644 --- a/src/main/java/org/jdesktop/j3d/examples/oriented_shape3d/MouseRotateY.java +++ b/src/main/java/org/jdesktop/j3d/examples/oriented_shape3d/MouseRotateY.java @@ -46,7 +46,7 @@ package org.jdesktop.j3d.examples.oriented_shape3d; import java.awt.AWTEvent; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.TransformGroup; import org.jogamp.java3d.WakeupCriterion; @@ -103,7 +103,8 @@ public class MouseRotateY extends MouseBehavior { super(flags); } - public void initialize() { + @Override +public void initialize() { super.initialize(); y_angle = 0; y_factor = .03; @@ -123,14 +124,15 @@ public class MouseRotateY extends MouseBehavior { } - public void processStimulus (Enumeration criteria) { + @Override +public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] event; int id; int dx; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { event = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); for (int i=0; i<event.length; i++) { diff --git a/src/main/java/org/jdesktop/j3d/examples/picking/IntersectInfoBehavior.java b/src/main/java/org/jdesktop/j3d/examples/picking/IntersectInfoBehavior.java index 56c12da..09b0908 100644 --- a/src/main/java/org/jdesktop/j3d/examples/picking/IntersectInfoBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/picking/IntersectInfoBehavior.java @@ -46,7 +46,7 @@ package org.jdesktop.j3d.examples.picking; import java.awt.AWTEvent; import java.awt.event.MouseEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Appearance; import org.jogamp.java3d.Behavior; @@ -147,17 +147,19 @@ public class IntersectInfoBehavior extends Behavior { } } - public void initialize() { + @Override +public void initialize() { wakeupOn (new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED)); } - public void processStimulus (Enumeration criteria) { + @Override +public void processStimulus (Iterator<WakeupCriterion> criteria) { WakeupCriterion wakeup; AWTEvent[] event; int eventId; - while (criteria.hasMoreElements()) { - wakeup = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + wakeup = criteria.next(); if (wakeup instanceof WakeupOnAWTEvent) { event = ((WakeupOnAWTEvent)wakeup).getAWTEvent(); for (int i=0; i<event.length; i++) { diff --git a/src/main/java/org/jdesktop/j3d/examples/picking/MorphingBehavior.java b/src/main/java/org/jdesktop/j3d/examples/picking/MorphingBehavior.java index 0aaf1e1..1184c76 100644 --- a/src/main/java/org/jdesktop/j3d/examples/picking/MorphingBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/picking/MorphingBehavior.java @@ -44,11 +44,12 @@ package org.jdesktop.j3d.examples.picking; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Morph; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; // User-defined morphing behavior class @@ -61,7 +62,8 @@ public class MorphingBehavior extends Behavior { WakeupOnElapsedFrames w = new WakeupOnElapsedFrames(0); // Override Behavior's initialize method to setup wakeup criteria - public void initialize() { + @Override + public void initialize() { alpha.setStartTime(System.currentTimeMillis()); // Establish initial wakeup criteria @@ -69,7 +71,8 @@ public class MorphingBehavior extends Behavior { } // Override Behavior's stimulus method to handle the event - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { // NOTE: This assumes 3 objects. It should be generalized to // "n" objects. diff --git a/src/main/java/org/jdesktop/j3d/examples/raster/ReadRaster.java b/src/main/java/org/jdesktop/j3d/examples/raster/ReadRaster.java index 6cf74fa..05d3c94 100644 --- a/src/main/java/org/jdesktop/j3d/examples/raster/ReadRaster.java +++ b/src/main/java/org/jdesktop/j3d/examples/raster/ReadRaster.java @@ -48,7 +48,7 @@ import java.applet.Applet; import java.awt.BorderLayout; import java.awt.GraphicsConfiguration; import java.awt.image.BufferedImage; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; import org.jogamp.java3d.BoundingSphere; @@ -62,6 +62,7 @@ import org.jogamp.java3d.RotationInterpolator; import org.jogamp.java3d.Shape3D; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.utils.applet.MainFrame; import org.jogamp.java3d.utils.geometry.ColorCube; import org.jogamp.java3d.utils.universe.SimpleUniverse; @@ -219,7 +220,7 @@ public class ReadRaster extends Applet } @Override - public void processStimulus(Enumeration criteria) + public void processStimulus(Iterator<WakeupCriterion> criteria) { synchronized (readRaster) diff --git a/src/main/java/org/jdesktop/j3d/examples/raster/ReadRasterGL2ES2.java b/src/main/java/org/jdesktop/j3d/examples/raster/ReadRasterGL2ES2.java index 445a169..75221a3 100644 --- a/src/main/java/org/jdesktop/j3d/examples/raster/ReadRasterGL2ES2.java +++ b/src/main/java/org/jdesktop/j3d/examples/raster/ReadRasterGL2ES2.java @@ -33,7 +33,7 @@ import java.applet.Applet; import java.awt.BorderLayout; import java.awt.GraphicsConfiguration; import java.awt.image.BufferedImage; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Alpha; import org.jogamp.java3d.BoundingSphere; @@ -47,6 +47,7 @@ import org.jogamp.java3d.RotationInterpolator; import org.jogamp.java3d.Shape3D; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.utils.applet.MainFrame; import org.jogamp.java3d.utils.shader.Cube; import org.jogamp.java3d.utils.universe.SimpleUniverse; @@ -208,7 +209,7 @@ public class ReadRasterGL2ES2 extends Applet } @Override - public void processStimulus(Enumeration criteria) + public void processStimulus(Iterator<WakeupCriterion> criteria) { synchronized (readRaster) diff --git a/src/main/java/org/jdesktop/j3d/examples/sound/AudioReverberate.java b/src/main/java/org/jdesktop/j3d/examples/sound/AudioReverberate.java index f54b43f..c6e6db1 100644 --- a/src/main/java/org/jdesktop/j3d/examples/sound/AudioReverberate.java +++ b/src/main/java/org/jdesktop/j3d/examples/sound/AudioReverberate.java @@ -45,12 +45,13 @@ package org.jdesktop.j3d.examples.sound; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.AuralAttributes; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.MediaContainer; import org.jogamp.java3d.PointSound; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnBehaviorPost; import org.jogamp.java3d.WakeupOnElapsedTime; import org.jogamp.vecmath.Point3f; @@ -98,6 +99,7 @@ public class AudioReverberate extends Behavior { int loopCount = 0; // Override Behavior's initialize method to setup wakeup criteria + @Override public void initialize() { MediaContainer sample = new MediaContainer(); sample.setCacheEnable(true); @@ -114,7 +116,8 @@ public class AudioReverberate extends Behavior { } // Override Behavior's stimulus method to handle the event - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { // time = System.currentTimeMillis(); if (firstTime) { wt = new WakeupOnElapsedTime(10000); diff --git a/src/main/java/org/jdesktop/j3d/examples/sound/BackgroundSoundBehavior.java b/src/main/java/org/jdesktop/j3d/examples/sound/BackgroundSoundBehavior.java index bc8f5e6..82c004c 100644 --- a/src/main/java/org/jdesktop/j3d/examples/sound/BackgroundSoundBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/sound/BackgroundSoundBehavior.java @@ -45,7 +45,7 @@ package org.jdesktop.j3d.examples.sound; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.BackgroundSound; import org.jogamp.java3d.Behavior; @@ -53,6 +53,7 @@ import org.jogamp.java3d.BoundingSphere; import org.jogamp.java3d.Bounds; import org.jogamp.java3d.MediaContainer; import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; import org.jogamp.vecmath.Point3d; @@ -73,12 +74,14 @@ public class BackgroundSoundBehavior extends Behavior { } - public void initialize() { + @Override + public void initialize() { wakeupOn(condition); } - public void processStimulus(Enumeration enumeration) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { wakeupOn(condition); } diff --git a/src/main/java/org/jdesktop/j3d/examples/sound/PointSoundBehavior.java b/src/main/java/org/jdesktop/j3d/examples/sound/PointSoundBehavior.java index 754847c..bdd583e 100644 --- a/src/main/java/org/jdesktop/j3d/examples/sound/PointSoundBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/sound/PointSoundBehavior.java @@ -45,7 +45,7 @@ package org.jdesktop.j3d.examples.sound; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.BoundingSphere; @@ -53,6 +53,7 @@ import org.jogamp.java3d.Bounds; import org.jogamp.java3d.MediaContainer; import org.jogamp.java3d.PointSound; import org.jogamp.java3d.WakeupCondition; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; import org.jogamp.vecmath.Point3d; import org.jogamp.vecmath.Point3f; @@ -77,12 +78,14 @@ public class PointSoundBehavior extends Behavior { } - public void initialize() { + @Override + public void initialize() { wakeupOn(condition); } - public void processStimulus(Enumeration enumeration) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { wakeupOn(condition); } diff --git a/src/main/java/org/jdesktop/j3d/examples/sound/SimpleSoundsBehavior.java b/src/main/java/org/jdesktop/j3d/examples/sound/SimpleSoundsBehavior.java index 3c7560e..6ae91ec 100644 --- a/src/main/java/org/jdesktop/j3d/examples/sound/SimpleSoundsBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/sound/SimpleSoundsBehavior.java @@ -45,7 +45,7 @@ package org.jdesktop.j3d.examples.sound; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.BackgroundSound; import org.jogamp.java3d.Behavior; @@ -53,6 +53,7 @@ import org.jogamp.java3d.BoundingSphere; import org.jogamp.java3d.MediaContainer; import org.jogamp.java3d.PointSound; import org.jogamp.java3d.Sound; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnBehaviorPost; import org.jogamp.java3d.WakeupOnElapsedTime; import org.jogamp.vecmath.Point3f; @@ -72,6 +73,7 @@ public class SimpleSoundsBehavior extends Behavior { BoundingSphere bounds; // Override Behavior's initialize method to setup wakeup criteria + @Override public void initialize() { MediaContainer sample1 = new MediaContainer(); MediaContainer sample2 = new MediaContainer(); @@ -111,7 +113,8 @@ public class SimpleSoundsBehavior extends Behavior { } // Override Behavior's stimulus method to handle the event - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { switch (soundIndex) { diff --git a/src/main/java/org/jdesktop/j3d/examples/stencil/StencilOutline.java b/src/main/java/org/jdesktop/j3d/examples/stencil/StencilOutline.java index 2684a2d..cdadb6d 100644 --- a/src/main/java/org/jdesktop/j3d/examples/stencil/StencilOutline.java +++ b/src/main/java/org/jdesktop/j3d/examples/stencil/StencilOutline.java @@ -34,7 +34,7 @@ import java.awt.GraphicsEnvironment; import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Enumeration; +import java.util.Iterator; import javax.swing.JOptionPane; @@ -287,10 +287,10 @@ public class StencilOutline extends javax.swing.JFrame private void setShaderProgram(Group g, ShaderAppearance myApp) { - Enumeration<Node> e = g.getAllChildren(); - while (e.hasMoreElements()) + Iterator<Node> e = g.getAllChildren(); + while (e.hasNext()) { - Node n = e.nextElement(); + Node n = e.next(); if (n instanceof Group) { setShaderProgram((Group) n, myApp); @@ -310,10 +310,10 @@ public class StencilOutline extends javax.swing.JFrame private void setOutline(Group g) { - Enumeration<Node> e = g.getAllChildren(); - while (e.hasMoreElements()) + Iterator<Node> e = g.getAllChildren(); + while (e.hasNext()) { - Node n = e.nextElement(); + Node n = e.next(); if (n instanceof Group) { setOutline((Group) n); diff --git a/src/main/java/org/jdesktop/j3d/examples/swing_interaction/SwingInteraction.java b/src/main/java/org/jdesktop/j3d/examples/swing_interaction/SwingInteraction.java index e360059..439d071 100644 --- a/src/main/java/org/jdesktop/j3d/examples/swing_interaction/SwingInteraction.java +++ b/src/main/java/org/jdesktop/j3d/examples/swing_interaction/SwingInteraction.java @@ -45,7 +45,7 @@ package org.jdesktop.j3d.examples.swing_interaction; import java.awt.GraphicsConfiguration; -import java.util.Enumeration; +import java.util.Iterator; import javax.swing.JPopupMenu; @@ -151,13 +151,15 @@ public class SwingInteraction extends javax.swing.JFrame { } // initialize behavior to wakeup on a behavior post with id = ROTATE - public void initialize() { + @Override + public void initialize() { criterion = new WakeupOnBehaviorPost(this, ROTATE); wakeupOn(criterion); } // processStimulus to rotate the cube - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { angle += Math.toRadians(10.0); trans.rotY(angle); transformGroup.setTransform(trans); @@ -194,7 +196,8 @@ public class SwingInteraction extends javax.swing.JFrame { rotateButton.setText("Rotate"); rotateButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { rotateButtonActionPerformed(evt); } }); @@ -214,7 +217,8 @@ public class SwingInteraction extends javax.swing.JFrame { fileMenu.setText("File"); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); @@ -241,7 +245,8 @@ public class SwingInteraction extends javax.swing.JFrame { */ public static void main(String args[]) {System.setProperty("sun.awt.noerasebackground", "true"); java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { + @Override + public void run() { new SwingInteraction().setVisible(true); } }); diff --git a/src/main/java/org/jdesktop/j3d/examples/text2d/MoverBehavior.java b/src/main/java/org/jdesktop/j3d/examples/text2d/MoverBehavior.java index 6005d5b..ac6513c 100644 --- a/src/main/java/org/jdesktop/j3d/examples/text2d/MoverBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/text2d/MoverBehavior.java @@ -46,7 +46,7 @@ package org.jdesktop.j3d.examples.text2d; import java.awt.AWTEvent; import java.awt.event.KeyEvent; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.BoundingSphere; @@ -69,7 +69,8 @@ class MoverBehavior extends Behavior TransformGroup viewTransformGroup; double rotation = 0.0; // holds current rotation radians - public void initialize() { + @Override + public void initialize() { // Establish initial wakeup criteria wakeupOn(w); } @@ -78,13 +79,14 @@ class MoverBehavior extends Behavior /** * Override Behavior's stimulus method to handle the event. */ - public void processStimulus(Enumeration criteria) { + @Override + public void processStimulus(Iterator<WakeupCriterion> criteria) { WakeupOnAWTEvent ev; WakeupCriterion genericEvt; AWTEvent[] events; - while (criteria.hasMoreElements()) { - genericEvt = (WakeupCriterion) criteria.nextElement(); + while (criteria.hasNext()) { + genericEvt = criteria.next(); if (genericEvt instanceof WakeupOnAWTEvent) { ev = (WakeupOnAWTEvent) genericEvt; events = ev.getAWTEvent(); diff --git a/src/main/java/org/jdesktop/j3d/examples/texture_by_ref/AnimateTexturesBehavior.java b/src/main/java/org/jdesktop/j3d/examples/texture_by_ref/AnimateTexturesBehavior.java index a0fb1e1..78b8dec 100644 --- a/src/main/java/org/jdesktop/j3d/examples/texture_by_ref/AnimateTexturesBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/texture_by_ref/AnimateTexturesBehavior.java @@ -45,7 +45,7 @@ package org.jdesktop.j3d.examples.texture_by_ref; import java.awt.image.BufferedImage; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Appearance; import org.jogamp.java3d.Behavior; @@ -132,7 +132,7 @@ public class AnimateTexturesBehavior extends Behavior { } // procesStimulus changes the ImageComponent of the texture - public void processStimulus(Enumeration criteria) { + public void processStimulus(Iterator<WakeupCriterion> criteria) { // ImageOps.printType(images[current].getImage()); texture.setImage(0, images[current]); appearance.setTexture(texture); diff --git a/src/main/java/org/jdesktop/j3d/examples/virtual_input_device/SensorBehavior.java b/src/main/java/org/jdesktop/j3d/examples/virtual_input_device/SensorBehavior.java index 0cb0ca6..cacf447 100644 --- a/src/main/java/org/jdesktop/j3d/examples/virtual_input_device/SensorBehavior.java +++ b/src/main/java/org/jdesktop/j3d/examples/virtual_input_device/SensorBehavior.java @@ -44,12 +44,13 @@ package org.jdesktop.j3d.examples.virtual_input_device; -import java.util.Enumeration; +import java.util.Iterator; import org.jogamp.java3d.Behavior; import org.jogamp.java3d.Sensor; import org.jogamp.java3d.Transform3D; import org.jogamp.java3d.TransformGroup; +import org.jogamp.java3d.WakeupCriterion; import org.jogamp.java3d.WakeupOnElapsedFrames; public class SensorBehavior extends Behavior { @@ -64,11 +65,13 @@ public class SensorBehavior extends Behavior { this.sensor = sensor; } - public void initialize() { + @Override + public void initialize() { wakeupOn( conditions ); } - public void processStimulus( Enumeration criteria ) { + @Override + public void processStimulus( Iterator<WakeupCriterion> criteria ) { sensor.getRead( transform ); transformGroup.setTransform( transform ); wakeupOn( conditions ); |