diff options
author | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-11-09 18:08:10 +0000 |
---|---|---|
committer | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-11-09 18:08:10 +0000 |
commit | b1e9202d36cb9998be404edcd64a0758415b7792 (patch) | |
tree | 7657ee555a32d2c11ba219d1061264b0506ce93c /src/classes/org/jdesktop | |
parent | 59ef25109b7243ebff8a130810bea0058e08c4ac (diff) |
Minor correction in use of "delay" and "random" flags.
Diffstat (limited to 'src/classes/org/jdesktop')
3 files changed, 11 insertions, 12 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.form b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.form index 661f402..5efa763 100644 --- a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.form +++ b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.form @@ -5,7 +5,7 @@ <Property name="defaultCloseOperation" type="int" value="3"/> </Properties> <SyntheticProperties> - <SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-110,0,0,3,-4"/> + <SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-35,0,0,3,-13"/> <SyntheticProperty name="formSizePolicy" type="int" value="0"/> <SyntheticProperty name="generateSize" type="boolean" value="true"/> <SyntheticProperty name="generateCenter" type="boolean" value="true"/> diff --git a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.java b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.java index a68bbe6..fae6679 100644 --- a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.java +++ b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JCanvas3DExample.java @@ -137,7 +137,7 @@ public class JCanvas3DExample extends javax.swing.JFrame implements java.awt.eve getContentPane().add(splitPane, java.awt.BorderLayout.CENTER); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - setBounds((screenSize.width-1020)/2, (screenSize.height-402)/2, 1020, 402); + setBounds((screenSize.width-1011)/2, (screenSize.height-733)/2, 1011, 733); } // Code for dispatching events from components to event handlers. @@ -158,9 +158,9 @@ public class JCanvas3DExample extends javax.swing.JFrame implements java.awt.eve private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed JInternalWorld iWorld; // we create an internal world to be added within the JDesktop. - iWorld = new JInternalWorld( interactiveCheckBox.isSelected(), - this.randomCheckBox.isSelected() && ( false == interactiveCheckBox.isSelected() ) - ); + iWorld = new JInternalWorld( interactiveCheckBox.isSelected(), + delayCheckBox.isSelected(), + randomCheckBox.isSelected() ); iWorld.setSize( 256, 256 ); iWorld.setLocation( 50, 50 ); iWorld.setResizable( true ); diff --git a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JInternalWorld.java b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JInternalWorld.java index 6bfa32d..84d0361 100644 --- a/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JInternalWorld.java +++ b/src/classes/org/jdesktop/j3d/examples/jcanvas3d/JInternalWorld.java @@ -87,7 +87,7 @@ public class JInternalWorld extends JInternalFrame { * @param isInteractive tells the world to be constructed as interactive * @param isDelayed tells the rotator to start at a random alpha. */ - public JInternalWorld(boolean isInteractive, boolean isDelayed) { + public JInternalWorld(boolean isInteractive, boolean isDelayed, boolean isRandom) { super(); setSize(256, 256); setClosable(true); @@ -108,7 +108,7 @@ public class JInternalWorld extends JInternalFrame { pack(); // Create a simple scene and attach it to the virtual universe - BranchGroup scene = createSceneGraph(isInteractive, isDelayed); + BranchGroup scene = createSceneGraph(isInteractive, isRandom); SimpleUniverse universe = new SimpleUniverse(canvas.getOffscreenCanvas3D()); //TODO: this is awful and must not be done like that in final version // This will move the ViewPlatform back a bit so the @@ -126,8 +126,7 @@ public class JInternalWorld extends JInternalFrame { * * @return a global branchgroup containing the world, as desired. */ - private BranchGroup createSceneGraph(boolean isInteractive, - boolean isDelayed) { + private BranchGroup createSceneGraph(boolean isInteractive, boolean isRandom) { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); @@ -165,15 +164,15 @@ public class JInternalWorld extends JInternalFrame { // rotation speed is randomized a bit so that it does not go at the same speed on every canvases, // which will make it more natural and express the differences between every present universes - int duration = Math.max(2000, (int) (Math.random() * 8000.)); Alpha rotationAlpha = null; - if (true == isDelayed) { + if (true == isRandom) { + int duration = Math.max(2000, (int) (Math.random() * 8000.)); rotationAlpha = new Alpha(-1, (int) ((double) duration * Math.random()), 0, duration, 0, 0); } else { - rotationAlpha = new Alpha(-1, duration); + rotationAlpha = new Alpha(-1, 4000); } RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, |