sim.display3d
Class Display3D

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bysim.display3d.Display3D
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, Steppable

public class Display3D
extends javax.swing.JComponent
implements Steppable

See Also:
Display2D, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 javax.swing.JFrame frame
           
protected  java.lang.Object intervalLock
           
 MovieMaker movmaker
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Display3D(int width, int height, GUIState simulation, long interval)
           
 
Method Summary
 void attach(Portrayal3D portrayal, java.lang.String name)
           
 void attach(Portrayal3D portrayal, java.lang.String name, boolean selected)
           
 javax.swing.JFrame createFrame()
          Creates a frame holding the Display3D.
 void createSceneGraph(boolean inspectingEnabled)
           
 void destroy()
           
 java.util.ArrayList detatchAll()
           
static java.lang.String ensureFileEndsWith(java.lang.String filename, java.lang.String ending)
           
protected  void finalize()
           
protected  long getInterval()
           
 javax.media.j3d.RotationInterpolator getSpinnterpolator()
           
static javax.media.j3d.Transform3D getTransformForAxis(double dx, double dy, double dz)
           
 javax.media.j3d.Transform3D getXaxis()
           
 javax.media.j3d.Transform3D getYaxis()
           
 javax.media.j3d.Transform3D getZaxis()
           
static void printT3D(javax.media.j3d.Transform3D t)
           
 void quit()
          Quits the Display3D.
 void refreshBoundsOnBehaviors()
           
 void reset()
          Resets the Display3D so it reschedules itself.
protected  void setInterval(long i)
           
 void setOrbitBehaviorEnabled(boolean b)
          Oribit behavior is moving the point of view around the scene.
 void setSelectBehaviorEnabled(boolean b)
           
 void setSpinBehaviorEnabled(boolean b)
           
 void startMovie()
           
 void step(SimState state)
           
 void stopMovie()
           
 void takeSnapshot()
          Ought only be done from the main event loop
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frame

public javax.swing.JFrame frame

intervalLock

protected java.lang.Object intervalLock

movmaker

public MovieMaker movmaker
Constructor Detail

Display3D

public Display3D(int width,
                 int height,
                 GUIState simulation,
                 long interval)
Method Detail

setInterval

protected void setInterval(long i)

getInterval

protected long getInterval()

createFrame

public javax.swing.JFrame createFrame()
Creates a frame holding the Display3D. This is the best method to create the frame, rather than making a frame and putting the Display3D in it. If you prefer the latter, then you need to handle two things. -First, you need to set the Display3D's "frame" field to it -Second, when the frame is disposed, you need to call quit() on the Display3D.


reset

public void reset()
Resets the Display3D so it reschedules itself. This is useful when reusing the Display3D.


attach

public void attach(Portrayal3D portrayal,
                   java.lang.String name)

attach

public void attach(Portrayal3D portrayal,
                   java.lang.String name,
                   boolean selected)

detatchAll

public java.util.ArrayList detatchAll()

createSceneGraph

public void createSceneGraph(boolean inspectingEnabled)

refreshBoundsOnBehaviors

public void refreshBoundsOnBehaviors()

getSpinnterpolator

public javax.media.j3d.RotationInterpolator getSpinnterpolator()

getYaxis

public javax.media.j3d.Transform3D getYaxis()

getXaxis

public javax.media.j3d.Transform3D getXaxis()

getZaxis

public javax.media.j3d.Transform3D getZaxis()

setSpinBehaviorEnabled

public void setSpinBehaviorEnabled(boolean b)

setOrbitBehaviorEnabled

public void setOrbitBehaviorEnabled(boolean b)
Oribit behavior is moving the point of view around the scene.


setSelectBehaviorEnabled

public void setSelectBehaviorEnabled(boolean b)

destroy

public void destroy()

step

public void step(SimState state)
Specified by:
step in interface Steppable

ensureFileEndsWith

public static java.lang.String ensureFileEndsWith(java.lang.String filename,
                                                  java.lang.String ending)

takeSnapshot

public void takeSnapshot()
Ought only be done from the main event loop


startMovie

public void startMovie()

stopMovie

public void stopMovie()

quit

public void quit()
Quits the Display3D. Called by finalize(). Otherwise you should call this method before destroying the Display3D. Right now the only thing this method does is stop and clean up the movie.


finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable
See Also:
Display2D.finalize()

getTransformForAxis

public static javax.media.j3d.Transform3D getTransformForAxis(double dx,
                                                              double dy,
                                                              double dz)

printT3D

public static void printT3D(javax.media.j3d.Transform3D t)