org.opensourcephysics.drawing2d.interaction
Class InteractionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by java.awt.AWTEvent
          extended by java.awt.event.ActionEvent
              extended by org.opensourcephysics.drawing2d.interaction.InteractionEvent
All Implemented Interfaces:
java.io.Serializable

public class InteractionEvent
extends java.awt.event.ActionEvent

Title: InteractionEvent

Description: This class is used to describe the basic interaction with a drawing element. It extends ActionEvent in order to allow for the object generating the event to include an object with additional information and the mouse event which was used in the interaction.

It is up to the interacted element to decide which information (object) to pass along.

Copyright: Open Source Physics project

Version:
June 2008
Author:
Francisco Esquembre
See Also:
Serialized Form

Field Summary
static int MOUSE_DRAGGED
          ID for the action of dragging the mouse on the element
static int MOUSE_ENTERED
          ID for the action of entering (lingering on) the element
static int MOUSE_EXITED
          ID for the action of exiting the element
static int MOUSE_MOVED
          ID for the action of moving the mouse on the element
static int MOUSE_PRESSED
          ID for the action of pressing the mouse on the element
static int MOUSE_RELEASED
          ID for the action of releasing the mouse on the element
 
Fields inherited from class java.awt.event.ActionEvent
ACTION_FIRST, ACTION_LAST, ACTION_PERFORMED, ALT_MASK, CTRL_MASK, META_MASK, SHIFT_MASK
 
Fields inherited from class java.awt.AWTEvent
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK
 
Constructor Summary
InteractionEvent(java.lang.Object _source, int _id, java.lang.String _command, java.lang.Object _info, java.awt.event.MouseEvent _mouseEvent)
          Constructor for the event
 
Method Summary
 java.lang.Object getInfo()
          The object with additional information provided by the source.
 java.awt.event.MouseEvent getMouseEvent()
          The mouse event which generated the interaction event.
 
Methods inherited from class java.awt.event.ActionEvent
getActionCommand, getModifiers, getWhen, paramString
 
Methods inherited from class java.awt.AWTEvent
getID, setSource, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MOUSE_PRESSED

public static final int MOUSE_PRESSED
ID for the action of pressing the mouse on the element

See Also:
Constant Field Values

MOUSE_DRAGGED

public static final int MOUSE_DRAGGED
ID for the action of dragging the mouse on the element

See Also:
Constant Field Values

MOUSE_RELEASED

public static final int MOUSE_RELEASED
ID for the action of releasing the mouse on the element

See Also:
Constant Field Values

MOUSE_ENTERED

public static final int MOUSE_ENTERED
ID for the action of entering (lingering on) the element

See Also:
Constant Field Values

MOUSE_EXITED

public static final int MOUSE_EXITED
ID for the action of exiting the element

See Also:
Constant Field Values

MOUSE_MOVED

public static final int MOUSE_MOVED
ID for the action of moving the mouse on the element

See Also:
Constant Field Values
Constructor Detail

InteractionEvent

public InteractionEvent(java.lang.Object _source,
                        int _id,
                        java.lang.String _command,
                        java.lang.Object _info,
                        java.awt.event.MouseEvent _mouseEvent)
Constructor for the event

Parameters:
_source - Object The object which generated the event.
_id - int An integer which identifies the type of event.
_command - String An action command associated to the event.
_info - Object The object provided as additional information.
_mouseEvent - MouseEvent The mouse event which generated the interaction event. It is useful to extract additional information such as the number of mouse clicks or the modifier keys and mouse buttons that were down during the event.
Method Detail

getInfo

public java.lang.Object getInfo()
The object with additional information provided by the source.

Returns:
Object

getMouseEvent

public java.awt.event.MouseEvent getMouseEvent()
The mouse event which generated the interaction event. It is useful to extract additional information such as the number of mouse clicks or the modifier keys and mouse buttons that were down during the event.

Returns:
MouseEvent