Package edu.umd.cs.piccolo.event
Class PBasicInputEventHandler
java.lang.Object
edu.umd.cs.piccolo.event.PBasicInputEventHandler
- All Implemented Interfaces:
PInputEventListener,EventListener
- Direct Known Subclasses:
PDragSequenceEventHandler,PInputManager
PBasicInputEventHandler is the standard class in Piccolo that is used
to register for mouse and keyboard events on a PNode. Note the events that
you get depends on the node that you have registered with. For example you
will only get mouse moved events when the mouse is over the node that you
have registered with, not when the mouse is over some other node.
- Version:
- 1.0
- Author:
- Jesse Grosjean
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PBasicInputEventHandler with a wide open event filter. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsEvent(PInputEvent event, int type) Returns true if the event would be dispatched if passed to processEvent.Returns the event filter responsible for filtering incoming events.voidkeyboardFocusGained(PInputEvent event) This method is invoked when a node gains the keyboard focus.voidkeyboardFocusLost(PInputEvent event) This method is invoked when a node loses the keyboard focus.voidkeyPressed(PInputEvent event) Will get called whenever a key has been pressed down.voidkeyReleased(PInputEvent event) Will get called whenever a key has been released.voidkeyTyped(PInputEvent event) Will be called at the end of a full keystroke (down then up).voidmouseClicked(PInputEvent event) Will be called at the end of a full click (mouse pressed followed by mouse released).voidmouseDragged(PInputEvent event) Will be called when a drag is occurring.voidmouseEntered(PInputEvent event) Will be invoked when the mouse enters a specified region.voidmouseExited(PInputEvent event) Will be invoked when the mouse leaves a specified region.voidmouseMoved(PInputEvent event) Will be called when the mouse is moved.voidmousePressed(PInputEvent event) Will be called when a mouse button is pressed down.voidmouseReleased(PInputEvent event) Will be called when any mouse button is released.voidmouseWheelRotated(PInputEvent event) This method is invoked when the mouse wheel is rotated.voidThis method is invoked when the mouse wheel is rotated by a block.protected StringDeprecated.see http://code.google.com/p/piccolo2d/issues/detail?id=99voidprocessEvent(PInputEvent event, int type) Dispatches a generic event to a more specific method.voidsetEventFilter(PInputEventFilter newEventFilter) Changes this event handler's filter to the one provided.
-
Constructor Details
-
PBasicInputEventHandler
public PBasicInputEventHandler()Constructs a PBasicInputEventHandler with a wide open event filter.
-
-
Method Details
-
processEvent
Dispatches a generic event to a more specific method. Sparing subclasses from the dispatch logic.- Specified by:
processEventin interfacePInputEventListener- Parameters:
event- the event to be dispatchedtype- Swing event type of the underlying Swing event
-
acceptsEvent
Returns true if the event would be dispatched if passed to processEvent.- Parameters:
event- event being tested for acceptancetype- Swing event type of underlying swing event- Returns:
- true if the event would be dispatched
-
getEventFilter
Returns the event filter responsible for filtering incoming events.- Returns:
- this handler's InputEventFilter
-
setEventFilter
Changes this event handler's filter to the one provided.- Parameters:
newEventFilter- filter to use for this input event handler
-
keyPressed
Will get called whenever a key has been pressed down. Subclasses should override this method to implement their own behavior.- Parameters:
event- the event representing the keystroke
-
keyReleased
Will get called whenever a key has been released. Subclasses should override this method to implement their own behavior.- Parameters:
event- the event representing the keystroke
-
keyTyped
Will be called at the end of a full keystroke (down then up). Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mouseClicked
Will be called at the end of a full click (mouse pressed followed by mouse released). Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mousePressed
Will be called when a mouse button is pressed down. Should two buttons be pressed simultaneously, it will dispatch two of these in an unspecified order. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mouseDragged
Will be called when a drag is occurring. This is system dependent. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mouseEntered
Will be invoked when the mouse enters a specified region. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mouseExited
Will be invoked when the mouse leaves a specified region. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for the event's details
-
mouseMoved
Will be called when the mouse is moved. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for event details
-
mouseReleased
Will be called when any mouse button is released. Should two or more buttons be released simultaneously, this method will be called multiple times. Subclasses should override this method to implement their own behavior.- Parameters:
event- object which can be queried for event details
-
mouseWheelRotated
This method is invoked when the mouse wheel is rotated. Subclasses should override this method to implement their own behavior.- Parameters:
event- an object that can be queries to discover the event's details
-
mouseWheelRotatedByBlock
This method is invoked when the mouse wheel is rotated by a block. Subclasses should override this method to implement their own behavior.- Parameters:
event- an object that can be queries to discover the event's details
-
keyboardFocusGained
This method is invoked when a node gains the keyboard focus. Subclasses should override this method to implement their own behavior.- Parameters:
event- an object that can be queries to discover the event's details
-
keyboardFocusLost
This method is invoked when a node loses the keyboard focus. Subclasses should override this method to implement their own behavior.- Parameters:
event- an object that can be queries to discover the event's details
-
paramString
Deprecated.see http://code.google.com/p/piccolo2d/issues/detail?id=99- Returns:
- empty string since this method is deprecated
-