public class MouseOnShape extends EventOnShape
MouseOnShape
is the super class of
PressOnShape
: mouse button pressed on a shape in the
canvas
ReleaseOnShape
: mouse button released on a shape in
the canvas
MoveOnShape
: mouse moved on a shape in the canvas
DragOnShape
: mouse dragged on a shape in the canvas
(move with a button pressed)
EnterOnShape
: mouse cursor entered on a shape in the
canvas
LeaveOnShape
: mouse cursor left a shape in the
canvas
For instance, the following code allows to specify a transition that fires only on the background of the canvas, where no shape is displayed. First specify an empty transition that fires on any shape, then a transition that fires anywhere on the canvas. For example:
public State s = new State () { Transition tshape = new PressOnShape (BUTTON1) { ... }; // captures button presses on shapes Transition tbackground = new Press (BUTTON1) { ... }; // captures button presses on background }
Constructor and Description |
---|
MouseOnShape()
Builds a mouse transition with any modifier that loops on the current
state.
|
MouseOnShape(int button)
Builds a mouse transition with any modifier that loops on the current
state.
|
MouseOnShape(int button,
int modifier)
Builds a mouse transition that loops on the current state.
|
MouseOnShape(int button,
int modifier,
java.lang.String outState)
Builds a mouse transition.
|
MouseOnShape(int button,
java.lang.String outState)
Builds a mouse transition with any modifier.
|
MouseOnShape(java.lang.String outState)
Builds a mouse transition with any modifier.
|
Modifier and Type | Method and Description |
---|---|
int |
getButton()
Returns the button of the mouse event that fires this transition.
|
java.awt.event.InputEvent |
getInputEvent() |
int |
getModifier()
Returns the modifier of the event that fires this transition.
|
java.awt.event.MouseEvent |
getMouseEvent() |
java.awt.geom.Point2D |
getPoint()
Returns the location at which this transition has occured.
|
CShape |
getShape()
Returns the CShape on which the event firing this transition has
occured.
|
java.lang.String |
toString() |
matches, pickingRequired
getClassEvent
action, getEvent, getInputState, getOutputState, guard, manageEventID, oldToString, setTriggeringEvent
public MouseOnShape(java.lang.String outState)
outState
- The name of the output statepublic MouseOnShape()
public MouseOnShape(int button, int modifier, java.lang.String outState)
button
- The button of the mouse event: NOBUTTON, BUTTON1, BUTTON2
or BUTTON3modifier
- The modifier: NOMODIFIER, CONTROL, ALT, SHIFT,
ALT_CONTROL, CONTROL_SHIFT, ALT_SHIFT or ALT_CONTROL_SHIFToutState
- The name of the output statepublic MouseOnShape(int button, int modifier)
button
- The button of the mouse event: NOBUTTON, BUTTON1, BUTTON2
or BUTTON3modifier
- The modifier: NOMODIFIER, CONTROL, ALT, SHIFT,
ALT_CONTROL, CONTROL_SHIFT, ALT_SHIFT or ALT_CONTROL_SHIFTpublic MouseOnShape(int button, java.lang.String outState)
button
- The button of the mouse event: NOBUTTON, BUTTON1, BUTTON2
or BUTTON3outState
- The name of the output statepublic MouseOnShape(int button)
button
- The button of the mouse event: NOBUTTON, BUTTON1, BUTTON2
or BUTTON3public int getButton()
public int getModifier()
public java.awt.event.InputEvent getInputEvent()
public java.awt.event.MouseEvent getMouseEvent()
public java.awt.geom.Point2D getPoint()
getPoint
in class EventOnShape
public CShape getShape()
getShape
in class EventOnShape
public java.lang.String toString()
toString
in class EventOnShape