com.sun.j3d.utils.behaviors.mouse
Class MouseBehavior

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Leaf
                    |
                    +--javax.media.j3d.Behavior
                          |
                          +--com.sun.j3d.utils.behaviors.mouse.MouseBehavior
Direct Known Subclasses:
MouseRotate, MouseTranslate, MouseZoom

public abstract class MouseBehavior
extends Behavior

Base class for all mouse manipulators (see MouseRotate, MouseZoom and MouseTranslate for examples of how to extend this base class).


Field Summary
protected  boolean buttonPress
           
protected  Transform3D currXform
           
protected  int flags
           
protected  boolean invert
           
static int INVERT_INPUT
          Set this flag if you want to invert the inputs.
static int MANUAL_WAKEUP
          Set this flag if you want to manually wakeup the behavior.
protected  WakeupOr mouseCriterion
           
protected  WakeupCriterion[] mouseEvents
           
protected  boolean reset
           
protected  TransformGroup transformGroup
           
protected  Transform3D transformX
           
protected  Transform3D transformY
           
protected  boolean wakeUp
           
protected  int x
           
protected  int x_last
           
protected  int y
           
protected  int y_last
           
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
MouseBehavior(int format)
          Initializes standard fields.
MouseBehavior(TransformGroup transformGroup)
          Creates a mouse behavior object with a given transform group.
 
Method Summary
 void initialize()
          Initializes the behavior.
 void processMouseEvent(java.awt.event.MouseEvent evt)
          Handles mouse events
abstract  void processStimulus(java.util.Enumeration criteria)
          All mouse manipulators must implement this.
 void setTransformGroup(TransformGroup transformGroup)
          Swap a new transformGroup replacing the old one.
 void wakeup()
          Manually wake up the behavior.
 
Methods inherited from class javax.media.j3d.Behavior
duplicateNode, getEnable, getSchedulingBoundingLeaf, getSchedulingBounds, getView, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, updateNodeReferences, wakeupOn
 
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mouseEvents

protected WakeupCriterion[] mouseEvents

mouseCriterion

protected WakeupOr mouseCriterion

x

protected int x

y

protected int y

x_last

protected int x_last

y_last

protected int y_last

transformGroup

protected TransformGroup transformGroup

transformX

protected Transform3D transformX

transformY

protected Transform3D transformY

currXform

protected Transform3D currXform

buttonPress

protected boolean buttonPress

reset

protected boolean reset

invert

protected boolean invert

wakeUp

protected boolean wakeUp

flags

protected int flags

MANUAL_WAKEUP

public static final int MANUAL_WAKEUP
Set this flag if you want to manually wakeup the behavior.

INVERT_INPUT

public static final int INVERT_INPUT
Set this flag if you want to invert the inputs. This is useful when the transform for the view platform is being changed instead of the transform for the object.
Constructor Detail

MouseBehavior

public MouseBehavior(TransformGroup transformGroup)
Creates a mouse behavior object with a given transform group.
Parameters:
transformGroup - The transform group to be manipulated.

MouseBehavior

public MouseBehavior(int format)
Initializes standard fields. Note that this behavior still needs a transform group to work on (use setTransformGroup(tg)) and the transform group must add this behavior.
Parameters:
format - flags
Method Detail

setTransformGroup

public void setTransformGroup(TransformGroup transformGroup)
Swap a new transformGroup replacing the old one. This allows manipulators to operate on different nodes.
Parameters:
transformGroup - The *new* transform group to be manipulated.

initialize

public void initialize()
Initializes the behavior.
Overrides:
initialize in class Behavior

wakeup

public void wakeup()
Manually wake up the behavior. If MANUAL_WAKEUP flag was set upon creation, you must wake up this behavior each time it is handled.

processMouseEvent

public void processMouseEvent(java.awt.event.MouseEvent evt)
Handles mouse events

processStimulus

public abstract void processStimulus(java.util.Enumeration criteria)
All mouse manipulators must implement this.
Overrides:
processStimulus in class Behavior
Tags copied from class: Behavior
Parameters:
criteria - an enumeration of triggered wakeup criteria for this behavior