public class JStateMachine extends BasicInputStateMachine implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener
The complete list of event types, i.e. classes of transitions, of a JStateMachine is:
Press, PressOnComponent, PressOnTag
: pressing a mouse button (anywhere / on a Component / on a Component with a given tag);
Release, ReleaseOnComponent, ReleaseOnTag
: releasing a mouse button (anywhere / on a Component / on a Component with a given tag);
Click, ClickOnComponent, ClickOnTag
: clicking (pressing and releasing in quick succession) a mouse button (anywhere / on a Component / on a Component with a given tag);
Move, MoveOnComponent, MoveOnTag
: moving the mouse with no button pressed (anywhere / on a Component / on a Component with a given tag);
Drag, DragOnComponent, DragOnTag
: moving the mouse with a button pressed (anywhere / on a Component / on a Component with a given tag);
EnterOnComponent, EnterOnTag
: cursor enters a Component / a Component with a given tag;
LeaveOnComponent, LeaveOnTag
: cursor leaves a Component / a Component with a given tag;
KeyPress, KeyRelease, KeyType
: typing a key (pressing, releasing, press then release in quick succession);
TimeOut
: delay specified by armTimer expired.
BasicInputStateMachine
ALT, ALT_CONTROL, ALT_CONTROL_SHIFT, ALT_SHIFT, ANYBUTTON, ANYMODIFIER, BUTTON1, BUTTON2, BUTTON3, CONTROL, CONTROL_SHIFT, NOBUTTON, NOMODIFIER, SHIFT
TIME_OUT
Constructor and Description |
---|
JStateMachine()
Builds a JStateMachine.
|
Modifier and Type | Method and Description |
---|---|
StateMachine |
attachTo(java.awt.Component c)
Attaches a component to this state machine.
|
StateMachine |
detachFrom(java.awt.Component c)
Removes a component from the control of this state machine.
|
static java.awt.Container |
getContentPane(java.awt.Component c) |
java.util.LinkedList |
getControlledObjects() |
static java.awt.Component |
getGlassPane(java.awt.Component component) |
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
processEvent(java.util.EventObject event)
Processes in the state machine the virtual event received.
|
addAsListenerOf, mouseWheelMoved, removeAsListenerOf
actionPerformed, addStateMachineListener, addStateMachineListener, armTimer, armTimer, consumes, disarmTimer, disarmTimer, doReset, doResume, doSuspend, eventOccured, fireEvent, fireEvent, getAllStates, getCurrentState, getInitialState, getState, hasConsumed, init, initStatesAndTransitions, isActive, isInited, processEvent, removeStateMachineListener, removeStateMachineListener, reset, resume, setActive, suspend
public StateMachine attachTo(java.awt.Component c)
JStateMachine
(the glasspane must be set before calling this attachTo
method).c
- The component to attach.public StateMachine detachFrom(java.awt.Component c)
c
- The component to detach.public java.util.LinkedList getControlledObjects()
Component
s monitored by this state machine as a linked list.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class BasicInputStateMachine
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class BasicInputStateMachine
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class BasicInputStateMachine
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class BasicInputStateMachine
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class BasicInputStateMachine
public static java.awt.Component getGlassPane(java.awt.Component component)
public void processEvent(java.util.EventObject event)
StateMachine
processEvent
in class StateMachine
event
- The virtual event to processpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class BasicInputStateMachine
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class BasicInputStateMachine
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
keyTyped
in class BasicInputStateMachine
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
keyPressed
in class BasicInputStateMachine
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
keyReleased
in class BasicInputStateMachine
public static java.awt.Container getContentPane(java.awt.Component c)