java.lang.Object java.awt.Event
public class 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).
static int
ACTION_EVENT
static int
ALT_MASK
Object
arg
static int
BACK_SPACE
static int
CAPS_LOCK
int
clickCount
MOUSE_DOWN
events, this field indicates the number of consecutive clicks. static int
CTRL_MASK
static int
DELETE
static int
DOWN
static int
END
static int
ENTER
static int
ESCAPE
Event
evt
static int
F1
static int
F10
static int
F11
static int
F12
static int
F2
static int
F3
static int
F4
static int
F5
static int
F6
static int
F7
static int
F8
static int
F9
static int
GOT_FOCUS
static int
HOME
int
id
Event
variables are relevant for the event. static int
INSERT
int
key
static int
KEY_ACTION
static int
KEY_ACTION_RELEASE
static int
KEY_PRESS
static int
KEY_RELEASE
static int
LEFT
static int
LIST_DESELECT
static int
LIST_SELECT
static int
LOAD_FILE
static int
LOST_FOCUS
static int
META_MASK
int
modifiers
static int
MOUSE_DOWN
static int
MOUSE_DRAG
static int
MOUSE_ENTER
static int
MOUSE_EXIT
static int
MOUSE_MOVE
static int
MOUSE_UP
static int
NUM_LOCK
static int
PAUSE
static int
PGDN
static int
PGUP
static int
PRINT_SCREEN
static int
RIGHT
static int
SAVE_FILE
static int
SCROLL_ABSOLUTE
static int
SCROLL_BEGIN
static int
SCROLL_END
static int
SCROLL_LINE_DOWN
static int
SCROLL_LINE_UP
static int
SCROLL_LOCK
static int
SCROLL_PAGE_DOWN
static int
SCROLL_PAGE_UP
static int
SHIFT_MASK
static int
TAB
Object
target
static int
UP
long
when
static int
WINDOW_DEICONIFY
static int
WINDOW_DESTROY
static int
WINDOW_EXPOSE
static int
WINDOW_ICONIFY
static int
WINDOW_MOVED
int
x
int
y
Event(Object target, int id, Object arg)
Event
class is obsolete and is available only for backwards compatilibility. Event(Object target, long when, int id, int x, int y, int key, int modifiers)
Event
class is obsolete and is available only for backwards compatilibility. Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)
Event
class is obsolete and is available only for backwards compatilibility. Method Summary boolean
controlDown()
Event
class is obsolete and is available only for backwards compatilibility. boolean
metaDown()
Event
class is obsolete and is available only for backwards compatilibility. protected String
paramString()
Event
class is obsolete and is available only for backwards compatilibility. boolean
shiftDown()
Event
class is obsolete and is available only for backwards compatilibility. String
toString()
Event
class is obsolete and is available only for backwards compatilibility. void
translate(int dx, int dy)
Event
class is obsolete and is available only for backwards compatilibility. SHIFT_MASK
public static final int SHIFT_MASK
public static final int CTRL_MASK
public static final int META_MASK
public static final int ALT_MASK
public static final int HOME
public static final int END
public static final int PGUP
public static final int PGDN
public static final int UP
public static final int DOWN
public static final int LEFT
public static final int RIGHT
public static final int F1
public static final int F2
public static final int F3
public static final int F4
public static final int F5
public static final int F6
public static final int F7
public static final int F8
public static final int F9
public static final int F10
public static final int F11
public static final int F12
public static final int PRINT_SCREEN
public static final int SCROLL_LOCK
public static final int CAPS_LOCK
public static final int NUM_LOCK
public static final int PAUSE
public static final int INSERT
public static final int ENTER
public static final int BACK_SPACE
public static final int TAB
public static final int ESCAPE
public static final int DELETE
public static final int WINDOW_DESTROY
public static final int WINDOW_EXPOSE
public static final int WINDOW_ICONIFY
public static final int WINDOW_DEICONIFY
public static final int WINDOW_MOVED
public static final int KEY_PRESS
public static final int KEY_RELEASE
public static final int KEY_ACTION
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.
public static final int KEY_ACTION_RELEASE
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.
public static final int MOUSE_DOWN
ALT_MASK
flag indicates that the middle button has been pressed. The META_MASK
flag indicates that the right button has been pressed.
ALT_MASK
, META_MASK
, Constant Field Values
public static final int MOUSE_UP
ALT_MASK
flag indicates that the middle button has been released. The META_MASK
flag indicates that the right button has been released.
ALT_MASK
, META_MASK
, Constant Field Values
public static final int MOUSE_MOVE
public static final int MOUSE_ENTER
public static final int MOUSE_EXIT
public static final int MOUSE_DRAG
ALT_MASK
flag indicates that the middle button is being pressed. The META_MASK
flag indicates that the right button is being pressed.
ALT_MASK
, META_MASK
, Constant Field Values
public static final int SCROLL_LINE_UP
public static final int SCROLL_LINE_DOWN
public static final int SCROLL_PAGE_UP
public static final int SCROLL_PAGE_DOWN
public static final int SCROLL_ABSOLUTE
public static final int SCROLL_BEGIN
public static final int SCROLL_END
public static final int LIST_SELECT
public static final int LIST_DESELECT
public static final int ACTION_EVENT
public static final int LOAD_FILE
public static final int SAVE_FILE
public static final int GOT_FOCUS
public static final int LOST_FOCUS
public Object target
EventObject.getSource()
public long when
InputEvent.getWhen()
public int id
Event
variables are relevant for the event. This has been replaced by AWTEvent.getID()
AWTEvent.getID()
public int x
MouseEvent.getX()
public int y
MouseEvent.getY()
public int key
KeyEvent.getKeyCode()
public int modifiers
InputEvent.getModifiers()
public int clickCount
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().
MouseEvent.getClickCount().
public Object arg
arg
has been replaced by event specific property.
public Event evt
EventQueue
public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)
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.
public Event(Object target, long when, int id, int x, int y, int key, int modifiers)
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.
public Event(Object target, int id, Object arg)
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.
public void translate(int dx, int dy)
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.
public boolean shiftDown()
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.
modifiers
, controlDown()
, metaDown()
public boolean controlDown()
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.
modifiers
, shiftDown()
, metaDown()
public boolean metaDown()
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.
modifiers
, shiftDown()
, controlDown()
protected String paramString()
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
.
public String toString()
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.
toString
in class Object
paramString()
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4