canvas
Class DefaultListener

java.lang.Object
  |
  +--java.awt.dnd.DragGestureRecognizer
        |
        +--canvas.DefaultListener
All Implemented Interfaces:
Serializable

public class DefaultListener
extends DragGestureRecognizer

Provides an infrastructure for listening for mouse, keyboard, and drag-and-drop events.

See Also:
Serialized Form

Field Summary
static boolean debug
           
static canvas.DragComponent involvedInDrop
           
 
Fields inherited from class java.awt.dnd.DragGestureRecognizer
component, dragGestureListener, dragSource, events, sourceActions
 
Constructor Summary
DefaultListener(Component component)
          Conststructs a new DefaultListener for the given component
 
Method Summary
protected  void addDragListener()
          This method is called by a DragComponent's addDragListener() method, you should not need to use it.
protected  void addMouseListener()
          This method is called by a DragComponent's addMouseListener() method, you should not need to use it.
 void charKeyPressed(char c)
           
 void downKeyPressed()
          This method should be overridden in a subclass to obtain functionality for "down" key presses.
 void enterKeyPressed()
          This method should be overridden in a subclass to obtain functionality for "enter" key presses.
 void leftKeyPressed()
          This method should be overridden in a subclass to obtain functionality for "left" key presses.
 void mouseClickedAt(int x, int y)
          This method should be overridden in a subclass to obtain functionality for Mouse Clicks within the associated component.
 void mouseDraggedTo(int x, int y)
          This method is called whenever the mouse is dragged, and the dragListener is not enabled, it should be overridden to obtain functionality.
 void mouseMovedTo(int x, int y)
          This method should be overridden in a subclass to obtain functionality for Mouse Movements within the associated component.
 void mousePressedAt(int x, int y)
          This method should be overridden in a subclass to obtain functionality for Mouse Presses within the associated component.
 void mouseReleasedAt(int x, int y)
          This method should be overridden in a subclass to obtain functionality for when the mouse is released.
 void registerKeyActions()
          This method is called by the DragComponent's addKeyboardListener() method, you should not need to use this method.
protected  void registerListeners()
          This method is called every time setComponent() is called, you should not need to use this method.
protected  void removeDragListener()
          This method is called by a DragComponent's removeDragListener() method, you should not need to use it.
 void removeKeyboardListener()
          This method is called by the DragComponent's removeKeyboardListener() method, you should not need to use this method.
protected  void removeMouseListener()
          This method is called by a DragComponent's removeMouseListener() method, you should not need to use it.
 void rightKeyPressed()
          This method should be overridden in a subclass to obtain functionality for "right" key presses.
static void setDebug(boolean d)
          Sets the debug boolean.
 void spacebarPressed()
          This method should be overridden in a subclass to obtain functionality for spacebar presses.
protected  void unregisterListeners()
          This method will remove all of the listeners from the component this DefaultListener is associated with.
 void upKeyPressed()
          This method should be overridden in a subclass to obtain functionality for "up" key presses.
 
Methods inherited from class java.awt.dnd.DragGestureRecognizer
addDragGestureListener, appendEvent, fireDragGestureRecognized, getComponent, getDragSource, getSourceActions, getTriggerEvent, removeDragGestureListener, resetRecognizer, setComponent, setSourceActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

involvedInDrop

public static canvas.DragComponent involvedInDrop
Constructor Detail

DefaultListener

public DefaultListener(Component component)
Conststructs a new DefaultListener for the given component

Parameters:
component - The Component that this listener will be associated with
Method Detail

setDebug

public static void setDebug(boolean d)
Sets the debug boolean.


addMouseListener

protected void addMouseListener()
This method is called by a DragComponent's addMouseListener() method, you should not need to use it.


removeMouseListener

protected void removeMouseListener()
This method is called by a DragComponent's removeMouseListener() method, you should not need to use it.


registerListeners

protected void registerListeners()
This method is called every time setComponent() is called, you should not need to use this method.

Specified by:
registerListeners in class DragGestureRecognizer

addDragListener

protected void addDragListener()
This method is called by a DragComponent's addDragListener() method, you should not need to use it.


removeDragListener

protected void removeDragListener()
This method is called by a DragComponent's removeDragListener() method, you should not need to use it.


unregisterListeners

protected void unregisterListeners()
This method will remove all of the listeners from the component this DefaultListener is associated with.

Specified by:
unregisterListeners in class DragGestureRecognizer

mouseDraggedTo

public void mouseDraggedTo(int x,
                           int y)
This method is called whenever the mouse is dragged, and the dragListener is not enabled, it should be overridden to obtain functionality.

Parameters:
x - the x-coordinate of the move
y - the y-coordinate of the move

mouseMovedTo

public void mouseMovedTo(int x,
                         int y)
This method should be overridden in a subclass to obtain functionality for Mouse Movements within the associated component.

Parameters:
x - the x-coordinate of the move
y - the y-coordinate of the move

mouseClickedAt

public void mouseClickedAt(int x,
                           int y)
This method should be overridden in a subclass to obtain functionality for Mouse Clicks within the associated component.

Parameters:
x - the x-coordinate of the click
y - the y-coordinate of the click

mousePressedAt

public void mousePressedAt(int x,
                           int y)
This method should be overridden in a subclass to obtain functionality for Mouse Presses within the associated component.

Parameters:
x - the x-coordinate of the press
y - the y-coordinate of the press

mouseReleasedAt

public void mouseReleasedAt(int x,
                            int y)
This method should be overridden in a subclass to obtain functionality for when the mouse is released.

Parameters:
x - the x-coordinate of the release
y - the y-coordinate of the release

charKeyPressed

public void charKeyPressed(char c)

upKeyPressed

public void upKeyPressed()
This method should be overridden in a subclass to obtain functionality for "up" key presses.


downKeyPressed

public void downKeyPressed()
This method should be overridden in a subclass to obtain functionality for "down" key presses.


leftKeyPressed

public void leftKeyPressed()
This method should be overridden in a subclass to obtain functionality for "left" key presses.


rightKeyPressed

public void rightKeyPressed()
This method should be overridden in a subclass to obtain functionality for "right" key presses.


enterKeyPressed

public void enterKeyPressed()
This method should be overridden in a subclass to obtain functionality for "enter" key presses.


spacebarPressed

public void spacebarPressed()
This method should be overridden in a subclass to obtain functionality for spacebar presses.


registerKeyActions

public void registerKeyActions()
This method is called by the DragComponent's addKeyboardListener() method, you should not need to use this method.


removeKeyboardListener

public void removeKeyboardListener()
This method is called by the DragComponent's removeKeyboardListener() method, you should not need to use this method.