Package com.sun.j3d.utils.behaviors.vp
Class ViewPlatformAWTBehavior
java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.Node
javax.media.j3d.Leaf
javax.media.j3d.Behavior
com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
com.sun.j3d.utils.behaviors.vp.ViewPlatformAWTBehavior
- All Implemented Interfaces:
KeyListener,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
- Direct Known Subclasses:
OrbitBehavior
public abstract class ViewPlatformAWTBehavior
extends ViewPlatformBehavior
implements MouseListener, MouseMotionListener, KeyListener, MouseWheelListener
Abstract class which implements much of the event tracking and
state updating in a thread safe manner.
AWT Events are captured and placed in a queue.
While there are pending events or motion the behavior will wake
up every frame, call processAWTEvents and integrateTransforms.
- Since:
- Java 3D 1.2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Canvas3D[]The Canvas3Ds from which this Behavior gets AWT eventsprotected WakeupOnElapsedFramesThe different criterion for the behavior to wakeupstatic final intFlag indicating Behavior should listen for Key Eventsprotected booleanBoolean for whether the mouse is in motionstatic final intFlag indicating Behavior should listen for Mouse Eventsstatic final intFlag indicating Behavior should listen for Mouse Motion Eventsstatic final intFlag indicating Behavior should listen for MouseWheel Eventsprotected static final intBehavior PostId used in this behaviorprotected WakeupOnBehaviorPostThe Or of the different criterion for the behavior to wakeupprotected Transform3DThe target Transform3D for this behaviorFields inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
homeTransform, targetTG, vpFields 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_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParameterless constructor for this behavior, intended for use by subclasses instantiated through ConfiguredUniverse.protectedViewPlatformAWTBehavior(int listenerFlags) Construct a behavior which listens for events specified by the given flags, intended for use by subclasses instantiated through ConfiguredUniverse.ViewPlatformAWTBehavior(Canvas3D c, int listenerFlags) Constructs a new ViewPlatformAWTBehavior. -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes the behavior.protected abstract voidCalled once per frame (if the view is moving) to calculate the new view platform transformvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidprotected abstract voidprocessAWTEvents(AWTEvent[] events) This is called once per frame if there are any AWT events to process.voidprocessStimulus(Enumeration behEnum) Process a stimulus meant for this behavior.protected voidQueue AWTEvents in a thread safe manner.voidsetEnable(boolean state) Overload setEnable from Behavior.protected voidsetListenerFlags(int listenerFlags) Sets listener flags for this behavior.voidSets the ViewingPlatform for this behavior.Methods inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
getHomeTransform, getViewingPlatform, goHome, setHomeTransformMethods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences, wakeupOnMethods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickableMethods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
-
Field Details
-
POST_ID
protected static final int POST_IDBehavior PostId used in this behavior- See Also:
-
frameWakeup
The different criterion for the behavior to wakeup -
postWakeup
The Or of the different criterion for the behavior to wakeup -
targetTransform
The target Transform3D for this behavior -
motion
protected boolean motionBoolean for whether the mouse is in motion -
MOUSE_LISTENER
public static final int MOUSE_LISTENERFlag indicating Behavior should listen for Mouse Events- See Also:
-
MOUSE_MOTION_LISTENER
public static final int MOUSE_MOTION_LISTENERFlag indicating Behavior should listen for Mouse Motion Events- See Also:
-
KEY_LISTENER
public static final int KEY_LISTENERFlag indicating Behavior should listen for Key Events- See Also:
-
MOUSE_WHEEL_LISTENER
public static final int MOUSE_WHEEL_LISTENERFlag indicating Behavior should listen for MouseWheel Events- See Also:
-
canvases
The Canvas3Ds from which this Behavior gets AWT events
-
-
Constructor Details
-
ViewPlatformAWTBehavior
protected ViewPlatformAWTBehavior()Parameterless constructor for this behavior, intended for use by subclasses instantiated through ConfiguredUniverse. Such a constructor is required for configurable behaviors.- Since:
- Java 3D 1.3
-
ViewPlatformAWTBehavior
protected ViewPlatformAWTBehavior(int listenerFlags) Construct a behavior which listens for events specified by the given flags, intended for use by subclasses instantiated through ConfiguredUniverse.- Parameters:
listenerFlags- Indicates which listener should be registered, one or more of MOUSE_LISTENER, MOUSE_MOTION_LISTENER, KEY_LISTENER, MOUSE_WHEEL_LISTENER- Since:
- Java 3D 1.3
-
ViewPlatformAWTBehavior
Constructs a new ViewPlatformAWTBehavior.- Parameters:
c- The Canvas3D on which to listen for events. If this is null a NullPointerException will be thrown.listenerFlags- Indicates which listener should be registered, one or more of MOUSE_LISTENER, MOUSE_MOTION_LISTENER, KEY_LISTENER, MOUSE_WHEEL_LISTENER
-
-
Method Details
-
setListenerFlags
protected void setListenerFlags(int listenerFlags) Sets listener flags for this behavior.- Parameters:
listenerFlags- Indicates which listener should be registered, one or more of MOUSE_LISTENER, MOUSE_MOTION_LISTENER, KEY_LISTENER, MOUSE_WHEEL_LISTENER- Since:
- Java 3D 1.3
-
initialize
public void initialize()Initializes the behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
initializein classBehavior
-
processStimulus
Process a stimulus meant for this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
processStimulusin classBehavior- Parameters:
behEnum- an enumeration of triggered wakeup criteria for this behavior
-
setEnable
public void setEnable(boolean state) Overload setEnable from Behavior. Adds/Removes the AWT listeners depending on the requested state. -
setViewingPlatform
Sets the ViewingPlatform for this behavior. This method is called by the ViewingPlatform. If a sub-calls overrides this method, it must call super.setViewingPlatform(vp). NOTE: Applications should not call this method.- Overrides:
setViewingPlatformin classViewPlatformBehavior- Parameters:
vp- the target ViewingPlatform for this behavior
-
processAWTEvents
This is called once per frame if there are any AWT events to process. Themotionvariable will be true when the method is called. If it is true when the method returns integrateTransforms will be called immediately. The AWTEvents are presented in the array in the order in which they arrived from AWT. -
integrateTransforms
protected abstract void integrateTransforms()Called once per frame (if the view is moving) to calculate the new view platform transform -
queueAWTEvent
Queue AWTEvents in a thread safe manner. If subclasses override this method they must call super.queueAWTEvent(e) -
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-