- java.lang.Object
-
- java.util.EventObject
-
- com.github.kwhat.jnativehook.NativeInputEvent
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NativeKeyEvent
,NativeMouseEvent
public class NativeInputEvent extends EventObject
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:
NativeKeyListener
,NativeMouseListener
,NativeMouseMotionListener
,NativeMouseWheelListener
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALT_L_MASK
The left alt key modifier constant.static int
ALT_MASK
Either the right or left alt key modifier constant.static int
ALT_R_MASK
The right alt key modifier constant.static int
BUTTON1_MASK
The Button1 modifier constant.static int
BUTTON2_MASK
The Button2 modifier constant.static int
BUTTON3_MASK
The Button3 modifier constant.static int
BUTTON4_MASK
The Button4 modifier constant.static int
BUTTON5_MASK
The Button5 modifier constant.static int
CAPS_LOCK_MASK
The Caps Lock modifier constant.static int
CTRL_L_MASK
The left ctrl key modifier constant.static int
CTRL_MASK
Either the right or left ctrl key modifier constant.static int
CTRL_R_MASK
The right ctrl key modifier constant.static int
META_L_MASK
The left meta key modifier constant.static int
META_MASK
Either the right or left meta key modifier constant.static int
META_R_MASK
The right meta key modifier constant.static int
NUM_LOCK_MASK
The Number Lock modifier constant.static int
SCROLL_LOCK_MASK
The Scroll Lock modifier constant.static int
SHIFT_L_MASK
The left shift key modifier constant.static int
SHIFT_MASK
Either the right or left shift key modifier constant.static int
SHIFT_R_MASK
The right shift key modifier constant.-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description NativeInputEvent(Class<GlobalScreen> source, int id, int modifiers)
Instantiates a new native input event.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getID()
Gets the event type.int
getModifiers()
Gets the modifier flags for this event.static String
getModifiersText(int modifiers)
Gets aString
describing the modifier flags, such as "Button1", or "Ctrl+Alt".long
getWhen()
Gets the platform dependent native interval for chronological event sequencing.String
paramString()
Gets aString
representation of this event.void
setModifiers(int modifiers)
Deprecated.-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Field Detail
-
SHIFT_L_MASK
public static final int SHIFT_L_MASK
The left shift key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
CTRL_L_MASK
public static final int CTRL_L_MASK
The left ctrl key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
META_L_MASK
public static final int META_L_MASK
The left meta key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
ALT_L_MASK
public static final int ALT_L_MASK
The left alt key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
SHIFT_R_MASK
public static final int SHIFT_R_MASK
The right shift key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
CTRL_R_MASK
public static final int CTRL_R_MASK
The right ctrl key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
META_R_MASK
public static final int META_R_MASK
The right meta key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
ALT_R_MASK
public static final int ALT_R_MASK
The right alt key modifier constant.- Since:
- 2.0
- See Also:
- Constant Field Values
-
SHIFT_MASK
public static final int SHIFT_MASK
Either the right or left shift key modifier constant.- See Also:
- Constant Field Values
-
CTRL_MASK
public static final int CTRL_MASK
Either the right or left ctrl key modifier constant.- See Also:
- Constant Field Values
-
META_MASK
public static final int META_MASK
Either the right or left meta key modifier constant.- See Also:
- Constant Field Values
-
ALT_MASK
public static final int ALT_MASK
Either the right or left alt key modifier constant.- See Also:
- Constant Field Values
-
BUTTON1_MASK
public static final int BUTTON1_MASK
The Button1 modifier constant.- See Also:
- Constant Field Values
-
BUTTON2_MASK
public static final int BUTTON2_MASK
The Button2 modifier constant.- See Also:
- Constant Field Values
-
BUTTON3_MASK
public static final int BUTTON3_MASK
The Button3 modifier constant.- See Also:
- Constant Field Values
-
BUTTON4_MASK
public static final int BUTTON4_MASK
The Button4 modifier constant.- See Also:
- Constant Field Values
-
BUTTON5_MASK
public static final int BUTTON5_MASK
The Button5 modifier constant.- See Also:
- Constant Field Values
-
NUM_LOCK_MASK
public static final int NUM_LOCK_MASK
The Number Lock modifier constant.- See Also:
- Constant Field Values
-
CAPS_LOCK_MASK
public static final int CAPS_LOCK_MASK
The Caps Lock modifier constant.- See Also:
- Constant Field Values
-
SCROLL_LOCK_MASK
public static final int SCROLL_LOCK_MASK
The Scroll Lock modifier constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NativeInputEvent
public NativeInputEvent(Class<GlobalScreen> source, int id, int modifiers)
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 _MASKInputEvent
modifiers.
-
-
Method Detail
-
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
public static String getModifiersText(int modifiers)
Gets aString
describing 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
public String paramString()
Gets aString
representation of this event. This method is useful for event-logging and debugging.- Returns:
- a string identifying the event and its attributes
-
-