j3d.org Code

org.j3d.renderer.java3d.navigation
Class MouseViewHandler

java.lang.Object
  extended byorg.j3d.renderer.java3d.navigation.NavigationProcessor
      extended byorg.j3d.renderer.java3d.navigation.NavigationHandler
          extended byorg.j3d.renderer.java3d.navigation.MouseViewHandler
All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, NavigationMouseProcessor

public class MouseViewHandler
extends NavigationHandler
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

An AWT based listener to drive navigation.

Instead of using behaviors this class does the job in a much smoother way by hooking AWT events directly from the canvas.

Version:
$Revision: 1.1 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.renderer.java3d.navigation.NavigationProcessor
AVATAR_CYLINDER, AVATAR_POINT, AVATAR_SHOULDERS
 
Constructor Summary
MouseViewHandler()
          Create a new mouse handler with no canvas or view information set.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent evt)
          Not used by this class
 void mouseEntered(java.awt.event.MouseEvent evt)
          Process a mouse enter event.
 void mouseExited(java.awt.event.MouseEvent evt)
          Not used by this class
 void mouseMoved(java.awt.event.MouseEvent evt)
          Not used by this class
 void setCanvas(javax.media.j3d.Canvas3D canvas)
          Set the canvas to use for this handler.
 void setViewInfo(javax.media.j3d.View view, javax.media.j3d.TransformGroup tg)
          Set the view and it's related transform group to use.
 
Methods inherited from class org.j3d.renderer.java3d.navigation.NavigationHandler
mouseDragged, mousePressed, mouseReleased, setButtonNavigation, setNavigationStateListener
 
Methods inherited from class org.j3d.renderer.java3d.navigation.NavigationProcessor
getNavigationState, getPosition, getTimerBehavior, move, orient, processNextFrame, setAvatarInfo, setCenterOfRotation, setCollisionListener, setFrameUpdateListener, setNavigationSpeed, setNavigationState, setOrbitTime, setViewInfo, setViewPath, setWorldInfo, startMove, stopMove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mousePressed, mouseReleased
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged
 

Constructor Detail

MouseViewHandler

public MouseViewHandler()
Create a new mouse handler with no canvas or view information set. This handler will not do anything until both canvas and view transform references have been set.

Method Detail

setViewInfo

public void setViewInfo(javax.media.j3d.View view,
                        javax.media.j3d.TransformGroup tg)
Set the view and it's related transform group to use. If a canvas is set and these are non-null the interaction will start immediately. Calling with both values as null will remove them and stop the process of updating the canvas.

Overrides:
setViewInfo in class NavigationProcessor
Parameters:
view - is the View object that we're modifying.
tg - The transform group above the view object that should be used

setCanvas

public void setCanvas(javax.media.j3d.Canvas3D canvas)
Set the canvas to use for this handler. Setting this will immediately register the listeners and start the operation if there is also a view and transform group. To remove the listener then call this method with the canvas parameter null.

Parameters:
canvas - The new canvas to use for this handler

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Not used by this class

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Not used by this class

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Process a mouse enter event. We use this to request focus for the canvas so that mouse handling works nicely.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
evt - The event that caused this method to be called

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Not used by this class

Specified by:
mouseExited in interface java.awt.event.MouseListener

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org