|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.event.PInputEvent
public class PInputEvent
PInputEvent is used to notify PInputEventListeners of keyboard and mouse input. It has methods for normal event properties such as event modifier keys and event canvas location.
In addition is has methods to get the mouse position and delta in a variety of coordinate systems.
Last of all it provides access to the dispatch manager that can be queried to find the current mouse over, mouse focus, and keyboard focus.
Constructor Summary | |
---|---|
PInputEvent(PInputManager inputManager,
InputEvent event)
Create an event with the given inputManager and based on the given swing event. |
Method Summary | |
---|---|
int |
getButton()
Returns the mouse button value of the underlying mouse event. |
PCamera |
getCamera()
Return the bottom most camera that is currently painting. |
PDimension |
getCanvasDelta()
Return the delta between the last and current mouse position in PCanvas coordinates. |
Point2D |
getCanvasPosition()
Return the mouse position in PCanvas coordinates. |
int |
getClickCount()
Returns the click count of the mouse event. |
PComponent |
getComponent()
Get the canvas associated with the top camera. |
PDimension |
getDelta()
Return the delta between the last and current mouse positions transformed through the view transform of the bottom camera. |
PDimension |
getDeltaRelativeTo(PNode nodeOnPath)
Return the delta between the last and current mouse positions relative to a given node on the pick path. |
PInputManager |
getInputManager()
Return the input manager that dispatched this event. |
char |
getKeyChar()
Returns the character associated with a key event. |
int |
getKeyCode()
Returns the key code associated with a key event. |
int |
getKeyLocation()
Returns the location on the keyboard from which the key stroke originated. |
int |
getModifiers()
Returns the modifiers provided for the input event by swing. |
int |
getModifiersEx()
Returns the extended modifiers provided for the input event by swing. |
PPickPath |
getPath()
Return the PPickPath associated with this input event. |
PNode |
getPickedNode()
Return the bottom node on the current pickpath, that is the picked node furthest from the root node. |
Point2D |
getPosition()
Return the mouse position transformed through the view transform of the bottom camera. |
Point2D |
getPositionRelativeTo(PNode nodeOnPath)
Return the mouse position relative to a given node on the pick path. |
InputEvent |
getSourceSwingEvent()
Returns the underlying swing event that this PInputEvent is wrapping. |
PCamera |
getTopCamera()
Return the topmost camera this is painting. |
int |
getWheelRotation()
Returns the current value of the wheel rotation on Mouse Wheel Rotation events. |
long |
getWhen()
Returns the time at which the event was emitted. |
boolean |
isActionKey()
Returns whether the key event involves the action key. |
boolean |
isAltDown()
Returns whether the alt key is currently down. |
boolean |
isControlDown()
Returns whether the control key is currently down. |
boolean |
isFocusEvent()
Returns whether the underlying event is a Focus Event. |
boolean |
isHandled()
Return true if another event handler has already handled this event. |
boolean |
isKeyEvent()
Returns whether the underlying event is a KeyEvent. |
boolean |
isLeftMouseButton()
Returns whether the mouse event involves the left mouse button. |
boolean |
isMetaDown()
Returns whether the meta key is currently down. |
boolean |
isMiddleMouseButton()
Returns whether the mouse event involves the middle mouse button. |
boolean |
isMouseEnteredOrMouseExited()
Returns whether the underlying event is a mouse entered or exited event. |
boolean |
isMouseEvent()
Returns whether the underlying event is a MouseEvent. |
boolean |
isMouseWheelEvent()
Returns whether the underlying event is a Mouse Wheel Event. |
boolean |
isPopupTrigger()
Returns whether or not this event is a popup menu trigger event for the platform. |
boolean |
isRightMouseButton()
Returns whether the mouse event involves the right mouse button. |
boolean |
isShiftDown()
Returns whether the shift key is currently down. |
void |
popCursor()
Removes the top most cursor from the cursor stack and sets it as the current cursor. |
void |
pushCursor(Cursor cursor)
Changes the cursor to the one provided and stores it on the cursor stack for later retrieval. |
void |
setHandled(boolean handled)
Set that this event has been handled by an event handler. |
void |
setPath(PPickPath path)
Sets the PIckPath associated with this mouse event. |
String |
toString()
Returns a string representation of this object for debugging purposes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PInputEvent(PInputManager inputManager, InputEvent event)
inputManager
- source of PInputEventevent
- underlying swing eventMethod Detail |
---|
public void pushCursor(Cursor cursor)
cursor
- cursor to push on cursor stackpublic void popCursor()
public PCamera getCamera()
public PCamera getTopCamera()
public PComponent getComponent()
public PInputManager getInputManager()
public PPickPath getPath()
public void setPath(PPickPath path)
path
- path to associate with this mouse eventpublic PNode getPickedNode()
public int getKeyCode()
public char getKeyChar()
public int getKeyLocation()
public boolean isActionKey()
public int getModifiers()
public int getModifiersEx()
public int getClickCount()
public long getWhen()
public boolean isAltDown()
public boolean isControlDown()
public boolean isMetaDown()
public boolean isShiftDown()
public boolean isLeftMouseButton()
public boolean isMiddleMouseButton()
public boolean isRightMouseButton()
public boolean isHandled()
public void setHandled(boolean handled)
handled
- whether the event is markedpublic int getButton()
public int getWheelRotation()
public InputEvent getSourceSwingEvent()
public boolean isKeyEvent()
public boolean isMouseEvent()
public boolean isMouseWheelEvent()
public boolean isFocusEvent()
public boolean isMouseEnteredOrMouseExited()
public boolean isPopupTrigger()
Note: Popup menus are triggered differently on different systems.
Therefore, isPopupTrigger
should be checked in both
mousePressed
and mouseReleased
for proper
cross-platform functionality.
public Point2D getCanvasPosition()
public PDimension getCanvasDelta()
public Point2D getPositionRelativeTo(PNode nodeOnPath)
nodeOnPath
- node on the current PPickPath
public PDimension getDeltaRelativeTo(PNode nodeOnPath)
nodeOnPath
- node from which to measure
public Point2D getPosition()
public PDimension getDelta()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |