|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.input.InputState
@ThreadSafe public class InputState
Class to keep track of a given input state. Includes mouse/pointer position and keyboard modifier key state.
Synchronization assumes that any given instance might be called from more than one event dispatch thread.
Constructor Summary | |
---|---|
InputState(Toolkit toolkit)
|
Method Summary | |
---|---|
int |
buttons()
Returns the mouse buttons used in the last input event. |
static Component |
childAt(Component parent,
Point where)
Returns the component under the given coordinates in the given parent component. |
void |
clear()
|
int |
clickCount()
Indicates the number of times a mouse button was clicked. |
Component |
deepestComponentUnderMousePointer()
Returns the most deeply nested component which currently contains the pointer. |
void |
dispose()
|
boolean |
dragInProgress()
Indicates there is a drag operation in progress. |
Point |
dragOrigin()
Returns the coordinates where a drag operation started. |
Component |
dragSource()
Returns the where a drag operation started. |
boolean |
isNativeDragActive()
Indicates whether there is a native drag/drop operation in progress. |
int |
keyModifiers()
Returns the currently pressed key modifiers. |
long |
lastEventTime()
Returns the time when the last input event occurred. |
int |
modifiers()
Returns all currently active modifiers. |
Component |
mouseComponent()
Returns the last known Component to contain the pointer, or null if none. |
Point |
mouseLocation()
Returns the mouse location relative to the component that currently contains the pointer, or null if
outside all components. |
Point |
mouseLocationOnScreen()
Returns the last known mouse location. |
void |
update(AWTEvent event)
Explicitly update the internal state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InputState(Toolkit toolkit)
Method Detail |
---|
public void clear()
public void dispose()
public void update(AWTEvent event)
event
- the event to use to update the internal state.public Component deepestComponentUnderMousePointer()
public Component mouseComponent()
null
if none. Note that this may not
correspond to the component that actually shows up in AWTEvents.
null
if none.public static Component childAt(Component parent, Point where)
The default Component.getComponentAt can return invisible components (JRootPane has an invisible JPanel (glass pane?) which will otherwise swallow everything).
NOTE: childAt grabs the TreeLock, so this should *only* be invoked on the event dispatch thread, preferably with no other locks held. Use it elsewhere at your own risk.
parent
- the given parent.where
- the given coordinates.
public boolean dragInProgress()
true
if there is a drag operation in progress, false
otherwise.public Component dragSource()
Component
where a drag operation started.
Component
where a drag operation started.public Point dragOrigin()
public int clickCount()
public long lastEventTime()
public int modifiers()
public int keyModifiers()
public int buttons()
public Point mouseLocation()
null
if
outside all components.
null
if
outside all components.public Point mouseLocationOnScreen()
public boolean isNativeDragActive()
true
if there is a native drag/drop operation in progress, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |