edu.neu.ccs.gui
Class MouseActionAdapter

java.lang.Object
  extended byedu.neu.ccs.gui.MouseActionAdapter
All Implemented Interfaces:
Cloneable, EventListener, MouseInputListener, MouseListener, MouseMotionListener, Serializable

public class MouseActionAdapter
extends Object
implements MouseInputListener, Cloneable, Serializable

An adapter class for receiving mouse input events and performing actions in response to those events.

Since:
1.0
Version:
2.4.0
See Also:
Serialized Form

Field Summary
protected  ActionSequence clickedActions
          List of action listeners to be performed upon the notification of mouse clicked events.
protected  ActionSequence draggedActions
          List of action listeners to be performed upon the notification of mouse dragged events.
protected  ActionSequence enteredActions
          List of action listeners to be performed upon the notification of mouse entered events.
protected  ActionSequence exitedActions
          List of action listeners to be performed upon the notification of mouse exited events.
protected  ActionSequence movedActions
          List of action listeners to be performed upon the notification of mouse moved events.
protected  ActionSequence pressedActions
          List of action listeners to be performed upon the notification of mouse pressed events.
protected  ActionSequence releasedActions
          List of action listeners to be performed upon the notification of mouse released events.
 
Constructor Summary
MouseActionAdapter()
          Constructs a mouse action adapter.
MouseActionAdapter(Component target)
          Constructs a mouse action adapter listening for mouse and mouse motion events generated by the given component.
 
Method Summary
 void addAsListenerTo(Component c)
          Registers this adapter to receive mouse events generated by the given component.
 void addMouseClickedAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse is clicked.
 void addMouseDraggedAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse is dragged.
 void addMouseEnteredAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse enters the component.
 void addMouseExitedAction(ActionListener a)
          Adds the given action to the action sequence so that it will be performed when the mouse exits the component.
 void addMouseMovedAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse is moved.
 void addMousePressedAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse button is pressed.
 void addMouseReleasedAction(ActionListener a)
          Adds the given action listener to the action sequence so that it will be performed when the mouse button is released.
 ActionSequence getMouseClickedActions()
          Returns the action sequence for mouse clicked events.
 ActionSequence getMouseDraggedActions()
          Returns the action sequence for mouse dragged events.
 ActionSequence getMouseEnteredActions()
          Returns the action sequence for mouse entered events.
 ActionSequence getMouseExitedActions()
          Returns the action sequence for mouse exited events.
 ActionSequence getMouseMovedActions()
          Returns the action sequence for mouse moved events.
 ActionSequence getMousePressedActions()
          Returns the action sequence for mouse pressed events.
 ActionSequence getMouseReleasedActions()
          Returns the action sequence for mouse released events.
 void mouseClicked(MouseEvent evt)
          Performs the stored action listener sequence when the mouse is clicked.
 void mouseDragged(MouseEvent evt)
          Performs the stored action listener sequence when the mouse is dragged.
 void mouseEntered(MouseEvent evt)
          Performs the stored action listener sequence when the mouse enters the component.
 void mouseExited(MouseEvent evt)
          Performs the stored action listener sequence when the mouse exits the component.
 void mouseMoved(MouseEvent evt)
          Performs the stored action listener sequence when the mouse is moved.
 void mousePressed(MouseEvent evt)
          Performs the stored action listener sequence when a mouse button is pressed.
 void mouseReleased(MouseEvent evt)
          Performs the stored action listener sequence when the mouse button is released.
 void removeAsListenerTo(Component c)
          Deregisters this adapter from receiving mouse events generated by the given component.
 void removeMouseClickedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is clicked.
 void removeMouseDraggedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is dragged.
 void removeMouseEnteredAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse enters the component.
 void removeMouseExitedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse exits the component.
 void removeMouseMovedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is moved.
 void removeMousePressedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is pressed.
 void removeMouseReleasedAction(ActionListener a)
          Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is released.
 void setMouseClickedActions(ActionSequence sequence)
          Sets the action sequence for mouse clicked events to the given action sequence.
 void setMouseDraggedActions(ActionSequence sequence)
          Sets the action sequence for mouse dragged events to the given action sequence.
 void setMouseEnteredActions(ActionSequence sequence)
          Sets the action sequence for mouse entered events to the given action sequence.
 void setMouseExitedActions(ActionSequence sequence)
          Sets the action sequence for mouse exited events to the given action sequence.
 void setMouseMovedActions(ActionSequence sequence)
          Sets the action sequence for mouse moved events to the given action sequence.
 void setMousePressedActions(ActionSequence sequence)
          Sets the action sequence for mouse pressed events to the given action sequence.
 void setMouseReleasedActions(ActionSequence sequence)
          Sets the action sequence for mouse released events to the given action sequence.
 void uninstallAllMouseActions()
          Uninstall all mouse actions for this adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clickedActions

protected ActionSequence clickedActions
List of action listeners to be performed upon the notification of mouse clicked events.


enteredActions

protected ActionSequence enteredActions
List of action listeners to be performed upon the notification of mouse entered events.


exitedActions

protected ActionSequence exitedActions
List of action listeners to be performed upon the notification of mouse exited events.


pressedActions

protected ActionSequence pressedActions
List of action listeners to be performed upon the notification of mouse pressed events.


releasedActions

protected ActionSequence releasedActions
List of action listeners to be performed upon the notification of mouse released events.


draggedActions

protected ActionSequence draggedActions
List of action listeners to be performed upon the notification of mouse dragged events.


movedActions

protected ActionSequence movedActions
List of action listeners to be performed upon the notification of mouse moved events.

Constructor Detail

MouseActionAdapter

public MouseActionAdapter()
Constructs a mouse action adapter.


MouseActionAdapter

public MouseActionAdapter(Component target)
Constructs a mouse action adapter listening for mouse and mouse motion events generated by the given component. If null, this adapter does not listen to a particular component by default.

Parameters:
target - the component that is listened to
Method Detail

mouseClicked

public final void mouseClicked(MouseEvent evt)
Performs the stored action listener sequence when the mouse is clicked.

Specified by:
mouseClicked in interface MouseListener
Parameters:
evt - the mouse event
See Also:
addMouseClickedAction(ActionListener), getMouseClickedActions()

mouseEntered

public final void mouseEntered(MouseEvent evt)
Performs the stored action listener sequence when the mouse enters the component.

Specified by:
mouseEntered in interface MouseListener
Parameters:
evt - the mouse event
See Also:
addMouseEnteredAction(ActionListener), getMouseEnteredActions()

mouseExited

public final void mouseExited(MouseEvent evt)
Performs the stored action listener sequence when the mouse exits the component.

Specified by:
mouseExited in interface MouseListener
Parameters:
evt - the mouse event
See Also:
addMouseExitedAction(ActionListener), getMouseExitedActions()

mousePressed

public final void mousePressed(MouseEvent evt)
Performs the stored action listener sequence when a mouse button is pressed.

Specified by:
mousePressed in interface MouseListener
Parameters:
evt - the mouse event
See Also:
addMousePressedAction(ActionListener), getMousePressedActions()

mouseReleased

public final void mouseReleased(MouseEvent evt)
Performs the stored action listener sequence when the mouse button is released.

Specified by:
mouseReleased in interface MouseListener
Parameters:
evt - the mouse event
See Also:
addMouseReleasedAction(ActionListener), getMouseReleasedActions()

mouseDragged

public final void mouseDragged(MouseEvent evt)
Performs the stored action listener sequence when the mouse is dragged.

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
evt - the mouse event
See Also:
addMouseDraggedAction(ActionListener), getMouseDraggedActions()

mouseMoved

public final void mouseMoved(MouseEvent evt)
Performs the stored action listener sequence when the mouse is moved.

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
evt - the mouse event
See Also:
addMouseMovedAction(ActionListener), getMouseMovedActions()

addAsListenerTo

public void addAsListenerTo(Component c)
Registers this adapter to receive mouse events generated by the given component. If the given component is null, no changes are made to this adapter.

Parameters:
c - the component that this adapter should listen to

removeAsListenerTo

public void removeAsListenerTo(Component c)
Deregisters this adapter from receiving mouse events generated by the given component. If the given component is null, no changes are made to this adapter.

Parameters:
c - the component that this adapter should stop listening to

addMouseClickedAction

public void addMouseClickedAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse is clicked.

Parameters:
a - the desired action listener
See Also:
removeMouseClickedAction(ActionListener), setMouseClickedActions(ActionSequence), getMouseClickedActions()

addMouseEnteredAction

public void addMouseEnteredAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse enters the component.

Parameters:
a - the desired action listener
See Also:
removeMouseEnteredAction(ActionListener), setMouseEnteredActions(ActionSequence), getMouseEnteredActions()

addMouseExitedAction

public void addMouseExitedAction(ActionListener a)
Adds the given action to the action sequence so that it will be performed when the mouse exits the component.

Parameters:
a - the desired action listener
See Also:
removeMouseExitedAction(ActionListener), setMouseExitedActions(ActionSequence), getMouseExitedActions()

addMousePressedAction

public void addMousePressedAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse button is pressed.

Parameters:
a - the desired action listener
See Also:
removeMousePressedAction(ActionListener), setMousePressedActions(ActionSequence), getMousePressedActions()

addMouseReleasedAction

public void addMouseReleasedAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse button is released.

Parameters:
a - the desired action listener
See Also:
removeMouseReleasedAction(ActionListener), setMouseReleasedActions(ActionSequence), getMouseReleasedActions()

addMouseDraggedAction

public void addMouseDraggedAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse is dragged.

Parameters:
a - the desired action listener
See Also:
removeMouseDraggedAction(ActionListener), setMouseDraggedActions(ActionSequence), getMouseDraggedActions()

addMouseMovedAction

public void addMouseMovedAction(ActionListener a)
Adds the given action listener to the action sequence so that it will be performed when the mouse is moved.

Parameters:
a - the desired action listener
See Also:
removeMouseMovedAction(ActionListener), setMouseMovedActions(ActionSequence), getMouseMovedActions()

removeMouseClickedAction

public void removeMouseClickedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is clicked.

Parameters:
a - the action listener to be removed
See Also:
addMouseClickedAction(ActionListener), setMouseClickedActions(ActionSequence), getMouseClickedActions()

removeMouseEnteredAction

public void removeMouseEnteredAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse enters the component.

Parameters:
a - the action listener to be removed
See Also:
addMouseEnteredAction(ActionListener), setMouseEnteredActions(ActionSequence), getMouseEnteredActions()

removeMouseExitedAction

public void removeMouseExitedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse exits the component.

Parameters:
a - the action listener to be removed
See Also:
addMouseExitedAction(ActionListener), setMouseExitedActions(ActionSequence), getMouseExitedActions()

removeMousePressedAction

public void removeMousePressedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is pressed.

Parameters:
a - the action listener to be removed
See Also:
addMousePressedAction(ActionListener), setMousePressedActions(ActionSequence), getMousePressedActions()

removeMouseReleasedAction

public void removeMouseReleasedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is released.

Parameters:
a - the action listener to be removed
See Also:
addMouseReleasedAction(ActionListener), setMouseReleasedActions(ActionSequence), getMouseReleasedActions()

removeMouseDraggedAction

public void removeMouseDraggedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is dragged.

Parameters:
a - the action listener to be removed
See Also:
addMouseDraggedAction(ActionListener), setMouseDraggedActions(ActionSequence), getMouseDraggedActions()

removeMouseMovedAction

public void removeMouseMovedAction(ActionListener a)
Removes the given action listener from this adapter so that it will be no longer be performed when the mouse is moved.

Parameters:
a - the action listener to be removed
See Also:
addMouseMovedAction(ActionListener), setMouseMovedActions(ActionSequence), getMouseMovedActions()

setMouseClickedActions

public void setMouseClickedActions(ActionSequence sequence)
Sets the action sequence for mouse clicked events to the given action sequence. If null, the action sequence for mouse clicked events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMouseClickedActions(), addMouseClickedAction(ActionListener), removeMouseClickedAction(ActionListener)

setMouseEnteredActions

public void setMouseEnteredActions(ActionSequence sequence)
Sets the action sequence for mouse entered events to the given action sequence. If null, the action sequence for mouse entered events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMouseEnteredActions(), addMouseEnteredAction(ActionListener), removeMouseEnteredAction(ActionListener)

setMouseExitedActions

public void setMouseExitedActions(ActionSequence sequence)
Sets the action sequence for mouse exited events to the given action sequence. If null, the action sequence for mouse exited events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
setMouseExitedActions(ActionSequence), addMouseExitedAction(ActionListener), removeMouseExitedAction(ActionListener)

setMousePressedActions

public void setMousePressedActions(ActionSequence sequence)
Sets the action sequence for mouse pressed events to the given action sequence. If null, the action sequence for mouse pressed events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMousePressedActions(), addMousePressedAction(ActionListener), removeMousePressedAction(ActionListener)

setMouseReleasedActions

public void setMouseReleasedActions(ActionSequence sequence)
Sets the action sequence for mouse released events to the given action sequence. If null, the action sequence for mouse released events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMouseReleasedActions(), addMouseReleasedAction(ActionListener), removeMouseReleasedAction(ActionListener)

setMouseDraggedActions

public void setMouseDraggedActions(ActionSequence sequence)
Sets the action sequence for mouse dragged events to the given action sequence. If null, the action sequence for mouse dragged events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMouseDraggedActions(), addMouseDraggedAction(ActionListener), removeMouseDraggedAction(ActionListener)

setMouseMovedActions

public void setMouseMovedActions(ActionSequence sequence)
Sets the action sequence for mouse moved events to the given action sequence. If null, the action sequence for mouse moved events is cleared.

Parameters:
sequence - the desired action sequence
See Also:
getMouseMovedActions(), addMouseMovedAction(ActionListener), removeMouseMovedAction(ActionListener)

getMouseClickedActions

public ActionSequence getMouseClickedActions()
Returns the action sequence for mouse clicked events.

See Also:
setMouseClickedActions(ActionSequence), addMouseClickedAction(ActionListener), removeMouseClickedAction(ActionListener)

getMouseEnteredActions

public ActionSequence getMouseEnteredActions()
Returns the action sequence for mouse entered events.

See Also:
setMouseEnteredActions(ActionSequence), addMouseEnteredAction(ActionListener), removeMouseEnteredAction(ActionListener)

getMouseExitedActions

public ActionSequence getMouseExitedActions()
Returns the action sequence for mouse exited events.

See Also:
setMouseExitedActions(ActionSequence), addMouseExitedAction(ActionListener), removeMouseExitedAction(ActionListener)

getMousePressedActions

public ActionSequence getMousePressedActions()
Returns the action sequence for mouse pressed events.

See Also:
setMousePressedActions(ActionSequence), addMousePressedAction(ActionListener), removeMousePressedAction(ActionListener)

getMouseReleasedActions

public ActionSequence getMouseReleasedActions()
Returns the action sequence for mouse released events.

See Also:
setMouseReleasedActions(ActionSequence), addMouseReleasedAction(ActionListener), removeMouseReleasedAction(ActionListener)

getMouseDraggedActions

public ActionSequence getMouseDraggedActions()
Returns the action sequence for mouse dragged events.

See Also:
setMouseDraggedActions(ActionSequence), addMouseDraggedAction(ActionListener), removeMouseDraggedAction(ActionListener)

getMouseMovedActions

public ActionSequence getMouseMovedActions()
Returns the action sequence for mouse moved events.

See Also:
setMouseMovedActions(ActionSequence), addMouseMovedAction(ActionListener), removeMouseMovedAction(ActionListener)

uninstallAllMouseActions

public void uninstallAllMouseActions()
Uninstall all mouse actions for this adapter.