java.lang.Object
java.util.EventObject
com.github.kwhat.jnativehook.NativeInputEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NativeKeyEvent,NativeMouseEvent
The root event class for all native-level input events. Input events are
delivered to listeners as they are received by the native source. There is
no method for listeners or subclasses to prevent delivery of the event to
the native system. There is no guarantee that the events will be received by
Java before they are delivered natively.
- Since:
- 1.0
- Version:
- 2.1
- Author:
- Alexander Barker (alex@1stleg.com)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe left alt key modifier constant.static final intEither the right or left alt key modifier constant.static final intThe right alt key modifier constant.static final intThe Button1 modifier constant.static final intThe Button2 modifier constant.static final intThe Button3 modifier constant.static final intThe Button4 modifier constant.static final intThe Button5 modifier constant.static final intThe Caps Lock modifier constant.static final intThe left ctrl key modifier constant.static final intEither the right or left ctrl key modifier constant.static final intThe right ctrl key modifier constant.static final intThe left meta key modifier constant.static final intEither the right or left meta key modifier constant.static final intThe right meta key modifier constant.static final intThe Number Lock modifier constant.static final intThe Scroll Lock modifier constant.static final intThe left shift key modifier constant.static final intEither the right or left shift key modifier constant.static final intThe right shift key modifier constant.Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionNativeInputEvent(Class<GlobalScreen> source, int id, int modifiers) Instantiates a new native input event. -
Method Summary
Modifier and TypeMethodDescriptionintgetID()Gets the event type.intGets the modifier flags for this event.static StringgetModifiersText(int modifiers) Gets aStringdescribing the modifier flags, such as "Button1", or "Ctrl+Alt".longgetWhen()Gets the platform dependent native interval for chronological event sequencing.Gets aStringrepresentation of this event.voidsetModifiers(int modifiers) Deprecated.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
SHIFT_L_MASK
public static final int SHIFT_L_MASKThe left shift key modifier constant.- Since:
- 2.0
- See Also:
-
CTRL_L_MASK
public static final int CTRL_L_MASKThe left ctrl key modifier constant.- Since:
- 2.0
- See Also:
-
META_L_MASK
public static final int META_L_MASKThe left meta key modifier constant.- Since:
- 2.0
- See Also:
-
ALT_L_MASK
public static final int ALT_L_MASKThe left alt key modifier constant.- Since:
- 2.0
- See Also:
-
SHIFT_R_MASK
public static final int SHIFT_R_MASKThe right shift key modifier constant.- Since:
- 2.0
- See Also:
-
CTRL_R_MASK
public static final int CTRL_R_MASKThe right ctrl key modifier constant.- Since:
- 2.0
- See Also:
-
META_R_MASK
public static final int META_R_MASKThe right meta key modifier constant.- Since:
- 2.0
- See Also:
-
ALT_R_MASK
public static final int ALT_R_MASKThe right alt key modifier constant.- Since:
- 2.0
- See Also:
-
SHIFT_MASK
public static final int SHIFT_MASKEither the right or left shift key modifier constant.- See Also:
-
CTRL_MASK
public static final int CTRL_MASKEither the right or left ctrl key modifier constant.- See Also:
-
META_MASK
public static final int META_MASKEither the right or left meta key modifier constant.- See Also:
-
ALT_MASK
public static final int ALT_MASKEither the right or left alt key modifier constant.- See Also:
-
BUTTON1_MASK
public static final int BUTTON1_MASKThe Button1 modifier constant.- See Also:
-
BUTTON2_MASK
public static final int BUTTON2_MASKThe Button2 modifier constant.- See Also:
-
BUTTON3_MASK
public static final int BUTTON3_MASKThe Button3 modifier constant.- See Also:
-
BUTTON4_MASK
public static final int BUTTON4_MASKThe Button4 modifier constant.- See Also:
-
BUTTON5_MASK
public static final int BUTTON5_MASKThe Button5 modifier constant.- See Also:
-
NUM_LOCK_MASK
public static final int NUM_LOCK_MASKThe Number Lock modifier constant.- See Also:
-
CAPS_LOCK_MASK
public static final int CAPS_LOCK_MASKThe Caps Lock modifier constant.- See Also:
-
SCROLL_LOCK_MASK
public static final int SCROLL_LOCK_MASKThe Scroll Lock modifier constant.- See Also:
-
-
Constructor Details
-
NativeInputEvent
Instantiates a new native input event.- Parameters:
source- The source of the event.id- The type of event.modifiers- the modifier keys down during event.NativeInputEvent_MASK modifiers should be used as they are not compatible with the extended _DOWN_MASK or the old _MASKInputEventmodifiers.
-
-
Method Details
-
getID
public int getID()Gets the event type.- Returns:
- the event type
-
getWhen
public long getWhen()Gets the platform dependent native interval for chronological event sequencing.- Returns:
- the native timestamp
-
getModifiers
public int getModifiers()Gets the modifier flags for this event.- Returns:
- the modifier flags
-
setModifiers
public void setModifiers(int modifiers) Deprecated.Sets the modifier flags for this event.- Parameters:
modifiers- the new modifier flags
-
getModifiersText
Gets aStringdescribing the modifier flags, such as "Button1", or "Ctrl+Alt". These strings can be localized by changing the awt.properties file.- Parameters:
modifiers- a modifier mask describing the modifier keys and mouse buttons of an event.- Returns:
- the modifier mask's textual representation.
-
paramString
Gets aStringrepresentation of this event. This method is useful for event-logging and debugging.- Returns:
- a string identifying the event and its attributes
-