java.lang.Object | |
↳ | java.awt.Event |
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Event
is a platform-independent class that
encapsulates events from the platform's Graphical User
Interface in the Java 1.0 event model. In Java 1.1
and later versions, the Event
class is maintained
only for backwards compatibilty. The information in this
class description is provided to assist programmers in
converting Java 1.0 programs to the new event model.
In the Java 1.0 event model, an event contains an
id
field
that indicates what type of event it is and which other
Event
variables are relevant for the event.
For keyboard events, key
contains a value indicating which key was activated, and
modifiers
contains the
modifiers for that event. For the KEY_PRESS and KEY_RELEASE
event ids, the value of key
is the unicode
character code for the key. For KEY_ACTION and
KEY_ACTION_RELEASE, the value of key
is
one of the defined action-key identifiers in the
Event
class (PGUP
,
PGDN
, F1
, F2
, etc).
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACTION_EVENT | This event indicates that the user wants some action to occur. | |||||||||
int | ALT_MASK | This flag indicates that the Alt key was down when the event occurred. | |||||||||
int | BACK_SPACE | The BackSpace key. | |||||||||
int | CAPS_LOCK | The Caps Lock key, a non-ASCII action key. | |||||||||
int | CTRL_MASK | This flag indicates that the Control key was down when the event occurred. | |||||||||
int | DELETE | The Delete key. | |||||||||
int | DOWN | The Down Arrow key, a non-ASCII action key. | |||||||||
int | END | The End key, a non-ASCII action key. | |||||||||
int | ENTER | The Enter key. | |||||||||
int | ESCAPE | The Escape key. | |||||||||
int | F1 | The F1 function key, a non-ASCII action key. | |||||||||
int | F10 | The F10 function key, a non-ASCII action key. | |||||||||
int | F11 | The F11 function key, a non-ASCII action key. | |||||||||
int | F12 | The F12 function key, a non-ASCII action key. | |||||||||
int | F2 | The F2 function key, a non-ASCII action key. | |||||||||
int | F3 | The F3 function key, a non-ASCII action key. | |||||||||
int | F4 | The F4 function key, a non-ASCII action key. | |||||||||
int | F5 | The F5 function key, a non-ASCII action key. | |||||||||
int | F6 | The F6 function key, a non-ASCII action key. | |||||||||
int | F7 | The F7 function key, a non-ASCII action key. | |||||||||
int | F8 | The F8 function key, a non-ASCII action key. | |||||||||
int | F9 | The F9 function key, a non-ASCII action key. | |||||||||
int | GOT_FOCUS | A component gained the focus. | |||||||||
int | HOME | The Home key, a non-ASCII action key. | |||||||||
int | INSERT | The Insert key, a non-ASCII action key. | |||||||||
int | KEY_ACTION | The user has pressed a non-ASCII action key. | |||||||||
int | KEY_ACTION_RELEASE | The user has released a non-ASCII action key. | |||||||||
int | KEY_PRESS | The user has pressed a normal key. | |||||||||
int | KEY_RELEASE | The user has released a normal key. | |||||||||
int | LEFT | The Left Arrow key, a non-ASCII action key. | |||||||||
int | LIST_DESELECT | An item in a list has been deselected. | |||||||||
int | LIST_SELECT | An item in a list has been selected. | |||||||||
int | LOAD_FILE | A file loading event. | |||||||||
int | LOST_FOCUS | A component lost the focus. | |||||||||
int | META_MASK | This flag indicates that the Meta key was down when the event occurred. | |||||||||
int | MOUSE_DOWN | The user has pressed the mouse button. | |||||||||
int | MOUSE_DRAG | The user has moved the mouse with a button pressed. | |||||||||
int | MOUSE_ENTER | The mouse has entered a component. | |||||||||
int | MOUSE_EXIT | The mouse has exited a component. | |||||||||
int | MOUSE_MOVE | The mouse has moved with no button pressed. | |||||||||
int | MOUSE_UP | The user has released the mouse button. | |||||||||
int | NUM_LOCK | The Num Lock key, a non-ASCII action key. | |||||||||
int | PAUSE | The Pause key, a non-ASCII action key. | |||||||||
int | PGDN | The Page Down key, a non-ASCII action key. | |||||||||
int | PGUP | The Page Up key, a non-ASCII action key. | |||||||||
int | PRINT_SCREEN | The Print Screen key, a non-ASCII action key. | |||||||||
int | RIGHT | The Right Arrow key, a non-ASCII action key. | |||||||||
int | SAVE_FILE | A file saving event. | |||||||||
int | SCROLL_ABSOLUTE | The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last postion. | |||||||||
int | SCROLL_BEGIN | The scroll begin event. | |||||||||
int | SCROLL_END | The scroll end event. | |||||||||
int | SCROLL_LINE_DOWN | The user has activated the line down area of a scroll bar. | |||||||||
int | SCROLL_LINE_UP | The user has activated the line up area of a scroll bar. | |||||||||
int | SCROLL_LOCK | The Scroll Lock key, a non-ASCII action key. | |||||||||
int | SCROLL_PAGE_DOWN | The user has activated the page down area of a scroll bar. | |||||||||
int | SCROLL_PAGE_UP | The user has activated the page up area of a scroll bar. | |||||||||
int | SHIFT_MASK | This flag indicates that the Shift key was down when the event occurred. | |||||||||
int | TAB | The Tab key. | |||||||||
int | UP | The Up Arrow key, a non-ASCII action key. | |||||||||
int | WINDOW_DEICONIFY | The user has asked the window manager to de-iconify the window. | |||||||||
int | WINDOW_DESTROY | The user has asked the window manager to kill the window. | |||||||||
int | WINDOW_EXPOSE | The user has asked the window manager to expose the window. | |||||||||
int | WINDOW_ICONIFY | The user has asked the window manager to iconify the window. | |||||||||
int | WINDOW_MOVED | The user has asked the window manager to move the window. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
arg | An arbitrary argument of the event. | ||||||||||
clickCount | For MOUSE_DOWN events, this field indicates the
number of consecutive clicks. |
||||||||||
evt | The next event. | ||||||||||
id | Indicates which type of event the event is, and which
other Event variables are relevant for the event. |
||||||||||
key | The key code of the key that was pressed in a keyboard event. | ||||||||||
modifiers | The state of the modifier keys. | ||||||||||
target | The target component. | ||||||||||
when | The time stamp. | ||||||||||
x | The x coordinate of the event. | ||||||||||
y | The y coordinate of the event. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. | |||||||||||
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NOTE: The
Event class is obsolete and is
available only for backwards compatilibility. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
This event indicates that the user wants some action to occur.
This flag indicates that the Alt key was down when the event occurred. For mouse events, this flag indicates that the middle mouse button was pressed or released.
The BackSpace key.
The Caps Lock key, a non-ASCII action key.
This flag indicates that the Control key was down when the event occurred.
The Delete key.
The Down Arrow key, a non-ASCII action key.
The End key, a non-ASCII action key.
The Enter key.
The Escape key.
The F1 function key, a non-ASCII action key.
The F10 function key, a non-ASCII action key.
The F11 function key, a non-ASCII action key.
The F12 function key, a non-ASCII action key.
The F2 function key, a non-ASCII action key.
The F3 function key, a non-ASCII action key.
The F4 function key, a non-ASCII action key.
The F5 function key, a non-ASCII action key.
The F6 function key, a non-ASCII action key.
The F7 function key, a non-ASCII action key.
The F8 function key, a non-ASCII action key.
The F9 function key, a non-ASCII action key.
A component gained the focus.
The Home key, a non-ASCII action key.
The Insert key, a non-ASCII action key.
The user has pressed a non-ASCII action key.
The key
field contains a value that indicates
that the event occurred on one of the action keys, which
comprise the 12 function keys, the arrow (cursor) keys,
Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
Caps Lock, Num Lock, Pause, and Insert.
The user has released a non-ASCII action key.
The key
field contains a value that indicates
that the event occurred on one of the action keys, which
comprise the 12 function keys, the arrow (cursor) keys,
Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
Caps Lock, Num Lock, Pause, and Insert.
The user has pressed a normal key.
The user has released a normal key.
The Left Arrow key, a non-ASCII action key.
An item in a list has been deselected.
An item in a list has been selected.
A file loading event.
A component lost the focus.
This flag indicates that the Meta key was down when the event occurred. For mouse events, this flag indicates that the right button was pressed or released.
The mouse has entered a component.
The mouse has exited a component.
The mouse has moved with no button pressed.
The Num Lock key, a non-ASCII action key.
The Pause key, a non-ASCII action key.
The Page Down key, a non-ASCII action key.
The Page Up key, a non-ASCII action key.
The Print Screen key, a non-ASCII action key.
The Right Arrow key, a non-ASCII action key.
A file saving event.
The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last postion.
The scroll begin event.
The scroll end event.
The user has activated the line down area of a scroll bar.
The user has activated the line up area of a scroll bar.
The Scroll Lock key, a non-ASCII action key.
The user has activated the page down area of a scroll bar.
The user has activated the page up area of a scroll bar.
This flag indicates that the Shift key was down when the event occurred.
The Tab key.
The Up Arrow key, a non-ASCII action key.
The user has asked the window manager to de-iconify the window.
The user has asked the window manager to kill the window.
The user has asked the window manager to expose the window.
The user has asked the window manager to iconify the window.
The user has asked the window manager to move the window.
An arbitrary argument of the event. The value of this field
depends on the type of event.
arg
has been replaced by event specific property.
For MOUSE_DOWN
events, this field indicates the
number of consecutive clicks. For other events, its value is
0
.
This field has been replaced by MouseEvent.getClickCount().@serial
The next event. This field is set when putting events into a linked list. This has been replaced by EventQueue.@serial
Indicates which type of event the event is, and which
other Event
variables are relevant for the event.
This has been replaced by AWTEvent.getID()@serial
The key code of the key that was pressed in a keyboard event. This has been replaced by KeyEvent.getKeyCode()@serial
The state of the modifier keys. This is replaced with InputEvent.getModifiers() In java 1.1 MouseEvent and KeyEvent are subclasses of InputEvent.@serial
The target component. This indicates the component over which the event occurred or with which the event is associated. This object has been replaced by AWTEvent.getSource()@serial
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Creates an instance of Event
with the specified target
component, time stamp, event type, x and y
coordinates, keyboard key, state of the modifier keys, and
argument.
target | the target component. |
---|---|
when | the time stamp. |
id | the event type. |
x | the x coordinate. |
y | the y coordinate. |
key | the key pressed in a keyboard event. |
modifiers | the state of the modifier keys. |
arg | the specified argument. |
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Creates an instance of Event
, with the specified target
component, time stamp, event type, x and y
coordinates, keyboard key, state of the modifier keys, and an
argument set to null
.
target | the target component. |
---|---|
when | the time stamp. |
id | the event type. |
x | the x coordinate. |
y | the y coordinate. |
key | the key pressed in a keyboard event. |
modifiers | the state of the modifier keys. |
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Creates an instance of Event
with the specified
target component, event type, and argument.
target | the target component. |
---|---|
id | the event type. |
arg | the specified argument. |
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Checks if the Control key is down.
true
if the key is down;
false
otherwise.NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Checks if the Meta key is down.
true
if the key is down;
false
otherwise.NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Checks if the Shift key is down.
true
if the key is down;
false
otherwise.NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Returns a representation of this event's values as a string.
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Translates this event so that its x and y coordinates are increased by dx and dy, respectively.
This method translates an event relative to the given component. This involves, at a minimum, translating the coordinates into the local coordinate system of the given component. It may also involve translating a region in the case of an expose event.
dx | the distance to translate the x coordinate. |
---|---|
dy | the distance to translate the y coordinate. |
NOTE: The Event
class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent
class and its subclasses.
Returns a string representing the state of this Event
.
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null
.