All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Event

java.lang.Object
   |
   +----java.awt.Event

public class Event
extends Object
implements Serializable
Event is a platform-independent class that encapsulates events from the local Graphical User Interface(GUI) platform.

The event contains an id which indicates the type of event it is and which other Event variables are relavent for the event. For keyboard events, key will contain a value indicating the key that was activated and modifiers will contain the modifiers. For KEY_PRESS and KEY_RELEASE event ids, the value of key will be the unicode character code for the key; for KEY_ACTION and KEY_ACTION_RELEASE, the value of key will be one of the defined action-key identifiers in the Event class (PGUP, PGDN, F1, F2, etc).


Variable Index

 o ACTION_EVENT
An action event.
 o ALT_MASK
The alt modifier constant.
 o arg
An arbitrary argument.
 o BACK_SPACE
The BackSpace key.
 o CAPS_LOCK
The CapsLock action-key.
 o clickCount
The number of consecutive clicks.
 o CTRL_MASK
The control modifier constant.
 o DELETE
The Delete key.
 o DOWN
The down arrow action-key.
 o END
The end action-key.
 o ENTER
The Enter key.
 o ESCAPE
The Escape key.
 o evt
The next event.
 o F1
The F1 function action-key.
 o F10
The F10 function action-key.
 o F11
The F11 function action-key.
 o F12
The F12 function action-key.
 o F2
The F2 function action-key.
 o F3
The F3 function action-key.
 o F4
The F4 function action-key.
 o F5
The F5 function action-key.
 o F6
The F6 function action-key.
 o F7
The F7 function action-key.
 o F8
The F8 function action-key.
 o F9
The F9 function action-key.
 o GOT_FOCUS
A component gained the focus.
 o HOME
The home action-key.
 o id
The type of this event.
 o INSERT
The Insert key.
 o key
The key code that was pressed in a keyboard event.
 o KEY_ACTION
The action-key press keyboard event.
 o KEY_ACTION_RELEASE
The action-key release keyboard event.
 o KEY_PRESS
The key press keyboard event.
 o KEY_RELEASE
The key release keyboard event.
 o LEFT
The left arrow action-key.
 o LIST_DESELECT
 o LIST_SELECT
 o LOAD_FILE
A file loading event.
 o LOST_FOCUS
A component lost the focus.
 o META_MASK
The meta modifier constant.
 o modifiers
The state of the modifier keys.
 o MOUSE_DOWN
The mouse down event.
 o MOUSE_DRAG
The mouse drag event.
 o MOUSE_ENTER
The mouse enter event.
 o MOUSE_EXIT
The mouse exit event.
 o MOUSE_MOVE
The mouse move event.
 o MOUSE_UP
The mouse up event.
 o NUM_LOCK
The NumLock action-key.
 o PAUSE
The Pause action-key.
 o PGDN
The page down action-key.
 o PGUP
The page up action-key.
 o PRINT_SCREEN
The PrintScreen action-key.
 o RIGHT
The right arrow action-key.
 o SAVE_FILE
A file saving event.
 o SCROLL_ABSOLUTE
The absolute scroll event.
 o SCROLL_BEGIN
The scroll begin event.
 o SCROLL_END
The scroll end event.
 o SCROLL_LINE_DOWN
The line down scroll event.
 o SCROLL_LINE_UP
The line up scroll event.
 o SCROLL_LOCK
The ScrollLock action-key.
 o SCROLL_PAGE_DOWN
The page down scroll event.
 o SCROLL_PAGE_UP
The page up scroll event.
 o SHIFT_MASK
The shift modifier constant.
 o TAB
The Tab key.
 o target
The target component.
 o UP
The up arrow action-key.
 o when
The time stamp.
 o WINDOW_DEICONIFY
The de-iconify window event.
 o WINDOW_DESTROY
The destroy window event.
 o WINDOW_EXPOSE
The expose window event.
 o WINDOW_ICONIFY
The iconify window event.
 o WINDOW_MOVED
The move window event.
 o x
The x coordinate of the event.
 o y
The y coordinate of the event.

Constructor Index

 o Event(Object, int, Object)
Constructs an event with the specified target component, event type, and argument.
 o Event(Object, long, int, int, int, int, int)
Constructs an 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.
 o Event(Object, long, int, int, int, int, int, Object)
Constructs an event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys and argument.

Method Index

 o controlDown()
Checks if the control key is down.
 o metaDown()
Checks if the meta key is down.
 o paramString()
Returns the parameter String of this Event.
 o shiftDown()
Checks if the shift key is down.
 o toString()
Returns the String representation of this Event's values.
 o translate(int, int)
Translates an event relative to the given component.

Variables

 o SHIFT_MASK
 public static final int SHIFT_MASK
The shift modifier constant.

 o CTRL_MASK
 public static final int CTRL_MASK
The control modifier constant.

 o META_MASK
 public static final int META_MASK
The meta modifier constant.

 o ALT_MASK
 public static final int ALT_MASK
The alt modifier constant.

 o HOME
 public static final int HOME
The home action-key.

 o END
 public static final int END
The end action-key.

 o PGUP
 public static final int PGUP
The page up action-key.

 o PGDN
 public static final int PGDN
The page down action-key.

 o UP
 public static final int UP
The up arrow action-key.

 o DOWN
 public static final int DOWN
The down arrow action-key.

 o LEFT
 public static final int LEFT
The left arrow action-key.

 o RIGHT
 public static final int RIGHT
The right arrow action-key.

 o F1
 public static final int F1
The F1 function action-key.

 o F2
 public static final int F2
The F2 function action-key.

 o F3
 public static final int F3
The F3 function action-key.

 o F4
 public static final int F4
The F4 function action-key.

 o F5
 public static final int F5
The F5 function action-key.

 o F6
 public static final int F6
The F6 function action-key.

 o F7
 public static final int F7
The F7 function action-key.

 o F8
 public static final int F8
The F8 function action-key.

 o F9
 public static final int F9
The F9 function action-key.

 o F10
 public static final int F10
The F10 function action-key.

 o F11
 public static final int F11
The F11 function action-key.

 o F12
 public static final int F12
The F12 function action-key.

 o PRINT_SCREEN
 public static final int PRINT_SCREEN
The PrintScreen action-key.

 o SCROLL_LOCK
 public static final int SCROLL_LOCK
The ScrollLock action-key.

 o CAPS_LOCK
 public static final int CAPS_LOCK
The CapsLock action-key.

 o NUM_LOCK
 public static final int NUM_LOCK
The NumLock action-key.

 o PAUSE
 public static final int PAUSE
The Pause action-key.

 o INSERT
 public static final int INSERT
The Insert key.

 o ENTER
 public static final int ENTER
The Enter key.

 o BACK_SPACE
 public static final int BACK_SPACE
The BackSpace key.

 o TAB
 public static final int TAB
The Tab key.

 o ESCAPE
 public static final int ESCAPE
The Escape key.

 o DELETE
 public static final int DELETE
The Delete key.

 o WINDOW_DESTROY
 public static final int WINDOW_DESTROY
The destroy window event.

 o WINDOW_EXPOSE
 public static final int WINDOW_EXPOSE
The expose window event.

 o WINDOW_ICONIFY
 public static final int WINDOW_ICONIFY
The iconify window event.

 o WINDOW_DEICONIFY
 public static final int WINDOW_DEICONIFY
The de-iconify window event.

 o WINDOW_MOVED
 public static final int WINDOW_MOVED
The move window event.

 o KEY_PRESS
 public static final int KEY_PRESS
The key press keyboard event.

 o KEY_RELEASE
 public static final int KEY_RELEASE
The key release keyboard event.

 o KEY_ACTION
 public static final int KEY_ACTION
The action-key press keyboard event.

 o KEY_ACTION_RELEASE
 public static final int KEY_ACTION_RELEASE
The action-key release keyboard event.

 o MOUSE_DOWN
 public static final int MOUSE_DOWN
The mouse down event.

 o MOUSE_UP
 public static final int MOUSE_UP
The mouse up event.

 o MOUSE_MOVE
 public static final int MOUSE_MOVE
The mouse move event.

 o MOUSE_ENTER
 public static final int MOUSE_ENTER
The mouse enter event.

 o MOUSE_EXIT
 public static final int MOUSE_EXIT
The mouse exit event.

 o MOUSE_DRAG
 public static final int MOUSE_DRAG
The mouse drag event.

 o SCROLL_LINE_UP
 public static final int SCROLL_LINE_UP
The line up scroll event.

 o SCROLL_LINE_DOWN
 public static final int SCROLL_LINE_DOWN
The line down scroll event.

 o SCROLL_PAGE_UP
 public static final int SCROLL_PAGE_UP
The page up scroll event.

 o SCROLL_PAGE_DOWN
 public static final int SCROLL_PAGE_DOWN
The page down scroll event.

 o SCROLL_ABSOLUTE
 public static final int SCROLL_ABSOLUTE
The absolute scroll event.

 o SCROLL_BEGIN
 public static final int SCROLL_BEGIN
The scroll begin event.

 o SCROLL_END
 public static final int SCROLL_END
The scroll end event.

 o LIST_SELECT
 public static final int LIST_SELECT
 o LIST_DESELECT
 public static final int LIST_DESELECT
 o ACTION_EVENT
 public static final int ACTION_EVENT
An action event.

 o LOAD_FILE
 public static final int LOAD_FILE
A file loading event.

 o SAVE_FILE
 public static final int SAVE_FILE
A file saving event.

 o GOT_FOCUS
 public static final int GOT_FOCUS
A component gained the focus.

 o LOST_FOCUS
 public static final int LOST_FOCUS
A component lost the focus.

 o target
 public Object target
The target component.

 o when
 public long when
The time stamp.

 o id
 public int id
The type of this event.

 o x
 public int x
The x coordinate of the event.

 o y
 public int y
The y coordinate of the event.

 o key
 public int key
The key code that was pressed in a keyboard event.

 o modifiers
 public int modifiers
The state of the modifier keys.

 o clickCount
 public int clickCount
The number of consecutive clicks. This field is relevant only for MOUSE_DOWN events. If the field isn't set it will be 0. Otherwise, it will be 1 for single-clicks, 2 for double-clicks, and so on.

 o arg
 public Object arg
An arbitrary argument.

 o evt
 public Event evt
The next event. Used when putting events into a linked list.

Constructors

 o Event
 public Event(Object target,
              long when,
              int id,
              int x,
              int y,
              int key,
              int modifiers,
              Object arg)
Constructs an 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
 o Event
 public Event(Object target,
              long when,
              int id,
              int x,
              int y,
              int key,
              int modifiers)
Constructs an 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.

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
 o Event
 public Event(Object target,
              int id,
              Object arg)
Constructs an event with the specified target component, event type, and argument.

Parameters:
target - the target component
id - the event type
arg - the specified argument

Methods

 o translate
 public void translate(int x,
                       int y)
Translates an event relative to the given component. This involves at a minimum translating the coordinates so they make sense within the given component. It may also involve translating a region in the case of an expose event.

Parameters:
x - the x coordinate
y - the y coordinate
 o shiftDown
 public boolean shiftDown()
Checks if the shift key is down.

See Also:
modifiers, controlDown, metaDown
 o controlDown
 public boolean controlDown()
Checks if the control key is down.

See Also:
modifiers, shiftDown, metaDown
 o metaDown
 public boolean metaDown()
Checks if the meta key is down.

See Also:
modifiers, shiftDown, controlDown
 o paramString
 protected String paramString()
Returns the parameter String of this Event.

 o toString
 public String toString()
Returns the String representation of this Event's values.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index