- All Implemented Interfaces:
Serializable
Event
class is obsolete and is
available only for backwards compatibility. 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 compatibility. 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).
- Since:
- 1.0
- See Also:
- Serialized Form
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Deprecated.This event indicates that the user wants some action to occur.static int
Deprecated.This flag indicates that the Alt key was down when the event occurred.Deprecated.An arbitrary argument of the event.static int
Deprecated.The BackSpace key.static int
Deprecated.The Caps Lock key, a non-ASCII action key.int
Deprecated.ForMOUSE_DOWN
events, this field indicates the number of consecutive clicks.static int
Deprecated.This flag indicates that the Control key was down when the event occurred.static int
Deprecated.The Delete key.static int
Deprecated.The Down Arrow key, a non-ASCII action key.static int
Deprecated.The End key, a non-ASCII action key.static int
Deprecated.The Enter key.static int
Deprecated.The Escape key.Deprecated.The next event.static int
Deprecated.The F1 function key, a non-ASCII action key.static int
Deprecated.The F10 function key, a non-ASCII action key.static int
Deprecated.The F11 function key, a non-ASCII action key.static int
Deprecated.The F12 function key, a non-ASCII action key.static int
Deprecated.The F2 function key, a non-ASCII action key.static int
Deprecated.The F3 function key, a non-ASCII action key.static int
Deprecated.The F4 function key, a non-ASCII action key.static int
Deprecated.The F5 function key, a non-ASCII action key.static int
Deprecated.The F6 function key, a non-ASCII action key.static int
Deprecated.The F7 function key, a non-ASCII action key.static int
Deprecated.The F8 function key, a non-ASCII action key.static int
Deprecated.The F9 function key, a non-ASCII action key.static int
Deprecated.A component gained the focus.static int
Deprecated.The Home key, a non-ASCII action key.int
Deprecated.Indicates which type of event the event is, and which otherEvent
variables are relevant for the event.static int
Deprecated.The Insert key, a non-ASCII action key.int
Deprecated.The key code of the key that was pressed in a keyboard event.static int
Deprecated.The user has pressed a non-ASCII action key.static int
Deprecated.The user has released a non-ASCII action key.static int
Deprecated.The user has pressed a normal key.static int
Deprecated.The user has released a normal key.static int
Deprecated.The Left Arrow key, a non-ASCII action key.static int
Deprecated.An item in a list has been deselected.static int
Deprecated.An item in a list has been selected.static int
Deprecated.A file loading event.static int
Deprecated.A component lost the focus.static int
Deprecated.This flag indicates that the Meta key was down when the event occurred.int
Deprecated.The state of the modifier keys.static int
Deprecated.The user has pressed the mouse button.static int
Deprecated.The user has moved the mouse with a button pressed.static int
Deprecated.The mouse has entered a component.static int
Deprecated.The mouse has exited a component.static int
Deprecated.The mouse has moved with no button pressed.static int
Deprecated.The user has released the mouse button.static int
Deprecated.The Num Lock key, a non-ASCII action key.static int
Deprecated.The Pause key, a non-ASCII action key.static int
Deprecated.The Page Down key, a non-ASCII action key.static int
Deprecated.The Page Up key, a non-ASCII action key.static int
Deprecated.The Print Screen key, a non-ASCII action key.static int
Deprecated.The Right Arrow key, a non-ASCII action key.static int
Deprecated.A file saving event.static int
Deprecated.The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last position.static int
Deprecated.The scroll begin event.static int
Deprecated.The scroll end event.static int
Deprecated.The user has activated the line down area of a scroll bar.static int
Deprecated.The user has activated the line up area of a scroll bar.static int
Deprecated.The Scroll Lock key, a non-ASCII action key.static int
Deprecated.The user has activated the page down area of a scroll bar.static int
Deprecated.The user has activated the page up area of a scroll bar.static int
Deprecated.This flag indicates that the Shift key was down when the event occurred.static int
Deprecated.The Tab key.Deprecated.The target component.static int
Deprecated.The Up Arrow key, a non-ASCII action key.long
Deprecated.The time stamp.static int
Deprecated.The user has asked the window manager to de-iconify the window.static int
Deprecated.The user has asked the window manager to kill the window.static int
Deprecated.The user has asked the window manager to expose the window.static int
Deprecated.The user has asked the window manager to iconify the window.static int
Deprecated.The user has asked the window manager to move the window.int
Deprecated.The x coordinate of the event.int
Deprecated.The y coordinate of the event. -
Constructor Summary
ConstructorDescriptionDeprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.boolean
metaDown()
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.protected String
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.boolean
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.toString()
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.void
translate(int dx, int dy)
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility.
-
Field Details
-
SHIFT_MASK
public static final int SHIFT_MASKDeprecated.This flag indicates that the Shift key was down when the event occurred.- See Also:
- Constant Field Values
-
CTRL_MASK
public static final int CTRL_MASKDeprecated.This flag indicates that the Control key was down when the event occurred.- See Also:
- Constant Field Values
-
META_MASK
public static final int META_MASKDeprecated.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.- See Also:
- Constant Field Values
-
ALT_MASK
public static final int ALT_MASKDeprecated.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.- See Also:
- Constant Field Values
-
HOME
public static final int HOMEDeprecated.The Home key, a non-ASCII action key.- See Also:
- Constant Field Values
-
END
public static final int ENDDeprecated.The End key, a non-ASCII action key.- See Also:
- Constant Field Values
-
PGUP
public static final int PGUPDeprecated.The Page Up key, a non-ASCII action key.- See Also:
- Constant Field Values
-
PGDN
public static final int PGDNDeprecated.The Page Down key, a non-ASCII action key.- See Also:
- Constant Field Values
-
UP
public static final int UPDeprecated.The Up Arrow key, a non-ASCII action key.- See Also:
- Constant Field Values
-
DOWN
public static final int DOWNDeprecated.The Down Arrow key, a non-ASCII action key.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFTDeprecated.The Left Arrow key, a non-ASCII action key.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHTDeprecated.The Right Arrow key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F1
public static final int F1Deprecated.The F1 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F2
public static final int F2Deprecated.The F2 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F3
public static final int F3Deprecated.The F3 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F4
public static final int F4Deprecated.The F4 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F5
public static final int F5Deprecated.The F5 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F6
public static final int F6Deprecated.The F6 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F7
public static final int F7Deprecated.The F7 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F8
public static final int F8Deprecated.The F8 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F9
public static final int F9Deprecated.The F9 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F10
public static final int F10Deprecated.The F10 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F11
public static final int F11Deprecated.The F11 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
F12
public static final int F12Deprecated.The F12 function key, a non-ASCII action key.- See Also:
- Constant Field Values
-
PRINT_SCREEN
public static final int PRINT_SCREENDeprecated.The Print Screen key, a non-ASCII action key.- See Also:
- Constant Field Values
-
SCROLL_LOCK
public static final int SCROLL_LOCKDeprecated.The Scroll Lock key, a non-ASCII action key.- See Also:
- Constant Field Values
-
CAPS_LOCK
public static final int CAPS_LOCKDeprecated.The Caps Lock key, a non-ASCII action key.- See Also:
- Constant Field Values
-
NUM_LOCK
public static final int NUM_LOCKDeprecated.The Num Lock key, a non-ASCII action key.- See Also:
- Constant Field Values
-
PAUSE
public static final int PAUSEDeprecated.The Pause key, a non-ASCII action key.- See Also:
- Constant Field Values
-
INSERT
public static final int INSERTDeprecated.The Insert key, a non-ASCII action key.- See Also:
- Constant Field Values
-
ENTER
public static final int ENTERDeprecated.The Enter key.- See Also:
- Constant Field Values
-
BACK_SPACE
public static final int BACK_SPACEDeprecated.The BackSpace key.- See Also:
- Constant Field Values
-
TAB
public static final int TABDeprecated.The Tab key.- See Also:
- Constant Field Values
-
ESCAPE
public static final int ESCAPEDeprecated.The Escape key.- See Also:
- Constant Field Values
-
DELETE
public static final int DELETEDeprecated.The Delete key.- See Also:
- Constant Field Values
-
WINDOW_DESTROY
public static final int WINDOW_DESTROYDeprecated.The user has asked the window manager to kill the window.- See Also:
- Constant Field Values
-
WINDOW_EXPOSE
public static final int WINDOW_EXPOSEDeprecated.The user has asked the window manager to expose the window.- See Also:
- Constant Field Values
-
WINDOW_ICONIFY
public static final int WINDOW_ICONIFYDeprecated.The user has asked the window manager to iconify the window.- See Also:
- Constant Field Values
-
WINDOW_DEICONIFY
public static final int WINDOW_DEICONIFYDeprecated.The user has asked the window manager to de-iconify the window.- See Also:
- Constant Field Values
-
WINDOW_MOVED
public static final int WINDOW_MOVEDDeprecated.The user has asked the window manager to move the window.- See Also:
- Constant Field Values
-
KEY_PRESS
public static final int KEY_PRESSDeprecated.The user has pressed a normal key.- See Also:
- Constant Field Values
-
KEY_RELEASE
public static final int KEY_RELEASEDeprecated.The user has released a normal key.- See Also:
- Constant Field Values
-
KEY_ACTION
public static final int KEY_ACTIONDeprecated.The user has pressed a non-ASCII action key. Thekey
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.- See Also:
- Constant Field Values
-
KEY_ACTION_RELEASE
public static final int KEY_ACTION_RELEASEDeprecated.The user has released a non-ASCII action key. Thekey
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.- See Also:
- Constant Field Values
-
MOUSE_DOWN
public static final int MOUSE_DOWNDeprecated.The user has pressed the mouse button. TheALT_MASK
flag indicates that the middle button has been pressed. TheMETA_MASK
flag indicates that the right button has been pressed.- See Also:
ALT_MASK
,META_MASK
, Constant Field Values
-
MOUSE_UP
public static final int MOUSE_UPDeprecated.The user has released the mouse button. TheALT_MASK
flag indicates that the middle button has been released. TheMETA_MASK
flag indicates that the right button has been released.- See Also:
ALT_MASK
,META_MASK
, Constant Field Values
-
MOUSE_MOVE
public static final int MOUSE_MOVEDeprecated.The mouse has moved with no button pressed.- See Also:
- Constant Field Values
-
MOUSE_ENTER
public static final int MOUSE_ENTERDeprecated.The mouse has entered a component.- See Also:
- Constant Field Values
-
MOUSE_EXIT
public static final int MOUSE_EXITDeprecated.The mouse has exited a component.- See Also:
- Constant Field Values
-
MOUSE_DRAG
public static final int MOUSE_DRAGDeprecated.The user has moved the mouse with a button pressed. TheALT_MASK
flag indicates that the middle button is being pressed. TheMETA_MASK
flag indicates that the right button is being pressed.- See Also:
ALT_MASK
,META_MASK
, Constant Field Values
-
SCROLL_LINE_UP
public static final int SCROLL_LINE_UPDeprecated.The user has activated the line up area of a scroll bar.- See Also:
- Constant Field Values
-
SCROLL_LINE_DOWN
public static final int SCROLL_LINE_DOWNDeprecated.The user has activated the line down area of a scroll bar.- See Also:
- Constant Field Values
-
SCROLL_PAGE_UP
public static final int SCROLL_PAGE_UPDeprecated.The user has activated the page up area of a scroll bar.- See Also:
- Constant Field Values
-
SCROLL_PAGE_DOWN
public static final int SCROLL_PAGE_DOWNDeprecated.The user has activated the page down area of a scroll bar.- See Also:
- Constant Field Values
-
SCROLL_ABSOLUTE
public static final int SCROLL_ABSOLUTEDeprecated.The user has moved the bubble (thumb) in a scroll bar, moving to an "absolute" position, rather than to an offset from the last position.- See Also:
- Constant Field Values
-
SCROLL_BEGIN
public static final int SCROLL_BEGINDeprecated.The scroll begin event.- See Also:
- Constant Field Values
-
SCROLL_END
public static final int SCROLL_ENDDeprecated.The scroll end event.- See Also:
- Constant Field Values
-
LIST_SELECT
public static final int LIST_SELECTDeprecated.An item in a list has been selected.- See Also:
- Constant Field Values
-
LIST_DESELECT
public static final int LIST_DESELECTDeprecated.An item in a list has been deselected.- See Also:
- Constant Field Values
-
ACTION_EVENT
public static final int ACTION_EVENTDeprecated.This event indicates that the user wants some action to occur.- See Also:
- Constant Field Values
-
LOAD_FILE
public static final int LOAD_FILEDeprecated.A file loading event.- See Also:
- Constant Field Values
-
SAVE_FILE
public static final int SAVE_FILEDeprecated.A file saving event.- See Also:
- Constant Field Values
-
GOT_FOCUS
public static final int GOT_FOCUSDeprecated.A component gained the focus.- See Also:
- Constant Field Values
-
LOST_FOCUS
public static final int LOST_FOCUSDeprecated.A component lost the focus.- See Also:
- Constant Field Values
-
target
Deprecated.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()- See Also:
EventObject.getSource()
-
when
public long whenDeprecated.The time stamp. Replaced by InputEvent.getWhen().- See Also:
InputEvent.getWhen()
-
id
public int idDeprecated.Indicates which type of event the event is, and which otherEvent
variables are relevant for the event. This has been replaced by AWTEvent.getID()- See Also:
AWTEvent.getID()
-
x
public int xDeprecated.The x coordinate of the event. Replaced by MouseEvent.getX()- See Also:
MouseEvent.getX()
-
y
public int yDeprecated.The y coordinate of the event. Replaced by MouseEvent.getY()- See Also:
MouseEvent.getY()
-
key
public int keyDeprecated.The key code of the key that was pressed in a keyboard event. This has been replaced by KeyEvent.getKeyCode()- See Also:
KeyEvent.getKeyCode()
-
modifiers
public int modifiersDeprecated.The state of the modifier keys. This is replaced with InputEvent.getModifiers() In java 1.1 MouseEvent and KeyEvent are subclasses of InputEvent.- See Also:
InputEvent.getModifiers()
-
clickCount
public int clickCountDeprecated.ForMOUSE_DOWN
events, this field indicates the number of consecutive clicks. For other events, its value is0
. This field has been replaced by MouseEvent.getClickCount().- See Also:
MouseEvent.getClickCount()
-
arg
Deprecated.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. -
evt
Deprecated.The next event. This field is set when putting events into a linked list. This has been replaced by EventQueue.- See Also:
EventQueue
-
-
Constructor Details
-
Event
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
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.- Parameters:
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.
-
Event
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
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 tonull
.- Parameters:
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.
-
Event
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
class and its subclasses.Creates an instance of
Event
with the specified target component, event type, and argument.- Parameters:
target
- the target component.id
- the event type.arg
- the specified argument.
-
-
Method Details
-
translate
public void translate(int dx, int dy)Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
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.
- Parameters:
dx
- the distance to translate the x coordinate.dy
- the distance to translate the y coordinate.
-
shiftDown
public boolean shiftDown()Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
class and its subclasses.Checks if the Shift key is down.
- Returns:
true
if the key is down;false
otherwise.- See Also:
modifiers
,controlDown()
,metaDown()
-
controlDown
public boolean controlDown()Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
class and its subclasses.Checks if the Control key is down.
- Returns:
true
if the key is down;false
otherwise.- See Also:
modifiers
,shiftDown()
,metaDown()
-
metaDown
public boolean metaDown()Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
class and its subclasses.Checks if the Meta key is down.
- Returns:
true
if the key is down;false
otherwise.- See Also:
modifiers
,shiftDown()
,controlDown()
-
paramString
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
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 benull
.- Returns:
- the parameter string of this event
-
toString
Deprecated.NOTE: TheEvent
class is obsolete and is available only for backwards compatibility. It has been replaced by theAWTEvent
class and its subclasses.Returns a representation of this event's values as a string.
- Overrides:
toString
in classObject
- Returns:
- a string that represents the event and the values of its member fields.
- Since:
- 1.1
- See Also:
paramString()
-
AWTEvent
and its subclasses be used instead