public class ButtonBehavior<C extends ButtonBase> extends BehaviorBase<C>
Modifier and Type | Field and Description |
---|---|
protected static java.util.List<KeyBinding> |
BUTTON_BINDINGS |
private boolean |
keyDown
Indicates that a keyboard key has been pressed which represents the
event (this could be space bar for example).
|
private static java.lang.String |
PRESS_ACTION |
private static java.lang.String |
RELEASE_ACTION |
IS_TOUCH_SUPPORTED, TRAVERSAL_BINDINGS, TRAVERSE_DOWN, TRAVERSE_LEFT, TRAVERSE_NEXT, TRAVERSE_PREVIOUS, TRAVERSE_RIGHT, TRAVERSE_UP
Constructor and Description |
---|
ButtonBehavior(C button)
*
Constructors *
*
|
ButtonBehavior(C button,
java.util.List<KeyBinding> bindings) |
Modifier and Type | Method and Description |
---|---|
protected void |
callAction(java.lang.String name)
Called to invoke the action associated with the given name.
|
protected void |
focusChanged()
*
Focus change handling *
*
|
private void |
keyPressed()
This function is invoked when an appropriate keystroke occurs which
causes this button to be armed if it is not already armed by a mouse
press.
|
private void |
keyReleased()
Invoked when a valid keystroke release occurs which causes the button
to fire if it was armed by a keyPress.
|
void |
mouseEntered(MouseEvent e)
Invoked when the mouse enters the Button.
|
void |
mouseExited(MouseEvent e)
Invoked when the mouse exits the Button.
|
void |
mousePressed(MouseEvent e)
Invoked when a mouse press has occurred over the button.
|
void |
mouseReleased(MouseEvent e)
Invoked when a mouse release has occurred.
|
callActionForEvent, contextMenuRequested, dispose, getControl, matchActionForEvent, mouseDragged, traverse, traverseDown, traverseLeft, traverseNext, traversePrevious, traverseRight, traverseUp
private boolean keyDown
private static final java.lang.String PRESS_ACTION
private static final java.lang.String RELEASE_ACTION
protected static final java.util.List<KeyBinding> BUTTON_BINDINGS
public ButtonBehavior(C button)
public ButtonBehavior(C button, java.util.List<KeyBinding> bindings)
protected void focusChanged()
focusChanged
in class BehaviorBase<C extends ButtonBase>
protected void callAction(java.lang.String name)
BehaviorBase
When a KeyEvent is handled, it is first passed through callActionForEvent which resolves which "action" should be executed based on the key event. This action is indicated by name. This name is then passed to this function which is responsible for invoking the right function based on the name.
callAction
in class BehaviorBase<C extends ButtonBase>
private void keyPressed()
private void keyReleased()
public void mousePressed(MouseEvent e)
mousePressed
in class BehaviorBase<C extends ButtonBase>
e
- the mouse eventpublic void mouseReleased(MouseEvent e)
mouseReleased
in class BehaviorBase<C extends ButtonBase>
e
- the mouse eventpublic void mouseEntered(MouseEvent e)
mouseEntered
in class BehaviorBase<C extends ButtonBase>
e
- the mouse eventpublic void mouseExited(MouseEvent e)
mouseExited
in class BehaviorBase<C extends ButtonBase>
e
- the mouse event