org.j3d.geom.overlay
Class InteractiveTextureOverlay

public class InteractiveTextureOverlay
extends org.j3d.geom.overlay.TextureOverlay
implements org.j3d.geom.overlay.InteractiveOverlay
An texture overlay extension that allows input events to be captured.

This class extends the standard texture with the InteractiveOverlay interface so that it may handle mouse and keyboard information. Typically this would be used to place an image on screen like a map and then get the mouse feedback to put the user in that position.

Version:
$Revision: 1.4 $
Author:
Justin Couch
Field Detail

requester

private org.j3d.geom.overlay.InputRequester requester
Input requester for input events

buffMouseList

private java.util.ArrayList buffMouseList
A buffer to hold listeners till a requester is set

Constructor Detail

InteractiveTextureOverlay

public InteractiveTextureOverlay(javax.media.j3d.Canvas3D canvas,
                                 java.awt.Dimension size)
Constructs an overlay window. This window will not be visible unless it is added to the scene under the view platform transform If the bounds are null, then resize the overlay to fit the canvas and then track the size of the canvas.
Parameters:
canvas - The canvas the overlay is drawn on
size - The size of the overlay in pixels
Throws:
IllegalArgumentException - Both the canvas and bounds are null

InteractiveTextureOverlay

public InteractiveTextureOverlay(javax.media.j3d.Canvas3D canvas,
                                 java.awt.Dimension size,
                                 javax.media.j3d.Texture2D texture)
Constructs an overlay window. This window will not be visible unless it is added to the scene under the view platform transform If the bounds are null, then resize the overlay to fit the canvas and then track the size of the canvas.
Parameters:
canvas - The canvas the overlay is drawn on
size - The size of the overlay in pixels
The - texture to be displayed. May be null
Throws:
IllegalArgumentException - Both the canvas and bounds are null

InteractiveTextureOverlay

public InteractiveTextureOverlay(javax.media.j3d.Canvas3D canvas,
                                 java.awt.Dimension size,
                                 boolean hasAlpha,
                                 org.j3d.geom.overlay.UpdateManager updateManager,
                                 javax.media.j3d.Texture2D texture)
Constructs an overlay window. This window will not be visible unless it is added to the scene under the view platform transform If the bounds are null, then resize the overlay to fit the canvas and then track the size of the canvas.
Parameters:
canvas - The canvas the overlay is drawn on
size - The size of the overlay in pixels
hasAlpha - True if the texture has an alpha component
updateManager - Responsible for allowing the Overlay to update between renders. If this is null a default manager is created
The - texture to be displayed. May be null
Throws:
IllegalArgumentException - Both the canvas and bounds are null

Method Detail

setInputRequester

public void setInputRequester(org.j3d.geom.overlay.InputRequester req)
Set the input requestor so that the overlay may manage when it requires input events. If the system is shutting down or the overlay is being removed, the parameter value may be null to clear a previously held instance.
Parameters:
req - The requestor instance to use or null

initLists

private void initLists()
Initialize the buffered lists used to defer listeners setting.

requestFocus

public void requestFocus()
Request that keyboard focus be sent to this listener object now.
Parameters:
key - The key of the object requesting focus now

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)
Request that the given listener enable mouse events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for
ovl - The overlay to base the mouse bounds handling on

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener l)
Request that the given listener disable mouse events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for
ovl - The overlay to base the mouse bounds handling on

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
Request that the given listener enable mouse motion events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for
ovl - The overlay to base the mouse bounds handling on

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
Request that the given listener disable mouse motion events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for
ovl - The overlay to base the mouse bounds handling on

addKeyListener

public void addKeyListener(java.awt.event.KeyListener l)
Request that the given listener enable key events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for
ovl - The overlay to base the mouse bounds handling on

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener l)
Request that the given listener disable key events being sent. If the listener instance is null, this request is ignored.
Parameters:
l - The listener to manage events for