Fields Summary |
---|
private transient long | data |
public static final int | SHIFT_MASKThis flag indicates that the Shift key was down when the event
occurred. |
public static final int | CTRL_MASKThis flag indicates that the Control key was down when the event
occurred. |
public static final int | META_MASKThis 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. |
public static final int | ALT_MASKThis 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. |
public static final int | HOMEThe Home key, a non-ASCII action key. |
public static final int | ENDThe End key, a non-ASCII action key. |
public static final int | PGUPThe Page Up key, a non-ASCII action key. |
public static final int | PGDNThe Page Down key, a non-ASCII action key. |
public static final int | UPThe Up Arrow key, a non-ASCII action key. |
public static final int | DOWNThe Down Arrow key, a non-ASCII action key. |
public static final int | LEFTThe Left Arrow key, a non-ASCII action key. |
public static final int | RIGHTThe Right Arrow key, a non-ASCII action key. |
public static final int | F1The F1 function key, a non-ASCII action key. |
public static final int | F2The F2 function key, a non-ASCII action key. |
public static final int | F3The F3 function key, a non-ASCII action key. |
public static final int | F4The F4 function key, a non-ASCII action key. |
public static final int | F5The F5 function key, a non-ASCII action key. |
public static final int | F6The F6 function key, a non-ASCII action key. |
public static final int | F7The F7 function key, a non-ASCII action key. |
public static final int | F8The F8 function key, a non-ASCII action key. |
public static final int | F9The F9 function key, a non-ASCII action key. |
public static final int | F10The F10 function key, a non-ASCII action key. |
public static final int | F11The F11 function key, a non-ASCII action key. |
public static final int | F12The F12 function key, a non-ASCII action key. |
public static final int | PRINT_SCREENThe Print Screen key, a non-ASCII action key. |
public static final int | SCROLL_LOCKThe Scroll Lock key, a non-ASCII action key. |
public static final int | CAPS_LOCKThe Caps Lock key, a non-ASCII action key. |
public static final int | NUM_LOCKThe Num Lock key, a non-ASCII action key. |
public static final int | PAUSEThe Pause key, a non-ASCII action key. |
public static final int | INSERTThe Insert key, a non-ASCII action key. |
public static final int | ENTERThe Enter key. |
public static final int | BACK_SPACEThe BackSpace key. |
public static final int | TABThe Tab key. |
public static final int | ESCAPEThe Escape key. |
public static final int | DELETEThe Delete key. |
private static final int | WINDOW_EVENT |
public static final int | WINDOW_DESTROYThe user has asked the window manager to kill the window. |
public static final int | WINDOW_EXPOSEThe user has asked the window manager to expose the window. |
public static final int | WINDOW_ICONIFYThe user has asked the window manager to iconify the window. |
public static final int | WINDOW_DEICONIFYThe user has asked the window manager to de-iconify the window. |
public static final int | WINDOW_MOVEDThe user has asked the window manager to move the window. |
private static final int | KEY_EVENT |
public static final int | KEY_PRESSThe user has pressed a normal key. |
public static final int | KEY_RELEASEThe user has released a normal key. |
public static final int | KEY_ACTIONThe 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. |
public static final int | KEY_ACTION_RELEASEThe 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. |
private static final int | MOUSE_EVENT |
public static final int | MOUSE_DOWNThe user has pressed the mouse button. The ALT_MASK
flag indicates that the middle button has been pressed.
The META_MASK flag indicates that the
right button has been pressed. |
public static final int | MOUSE_UPThe user has released the mouse button. The ALT_MASK
flag indicates that the middle button has been released.
The META_MASK flag indicates that the
right button has been released. |
public static final int | MOUSE_MOVEThe mouse has moved with no button pressed. |
public static final int | MOUSE_ENTERThe mouse has entered a component. |
public static final int | MOUSE_EXITThe mouse has exited a component. |
public static final int | MOUSE_DRAGThe user has moved the mouse with a button pressed. The
ALT_MASK flag indicates that the middle
button is being pressed. The META_MASK flag indicates
that the right button is being pressed. |
private static final int | SCROLL_EVENT |
public static final int | SCROLL_LINE_UPThe user has activated the line up
area of a scroll bar. |
public static final int | SCROLL_LINE_DOWNThe user has activated the line down
area of a scroll bar. |
public static final int | SCROLL_PAGE_UPThe user has activated the page up
area of a scroll bar. |
public static final int | SCROLL_PAGE_DOWNThe user has activated the page down
area of a scroll bar. |
public static final int | SCROLL_ABSOLUTEThe user has moved the bubble (thumb) in a scroll bar,
moving to an "absolute" position, rather than to
an offset from the last postion. |
public static final int | SCROLL_BEGINThe scroll begin event. |
public static final int | SCROLL_ENDThe scroll end event. |
private static final int | LIST_EVENT |
public static final int | LIST_SELECTAn item in a list has been selected. |
public static final int | LIST_DESELECTAn item in a list has been deselected. |
private static final int | MISC_EVENT |
public static final int | ACTION_EVENTThis event indicates that the user wants some action to occur. |
public static final int | LOAD_FILEA file loading event. |
public static final int | SAVE_FILEA file saving event. |
public static final int | GOT_FOCUSA component gained the focus. |
public static final int | LOST_FOCUSA component lost the focus. |
public Object | targetThe 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() |
public long | whenThe time stamp.
Replaced by InputEvent.getWhen(). |
public int | idIndicates which type of event the event is, and which
other Event variables are relevant for the event.
This has been replaced by AWTEvent.getID() |
public int | xThe x coordinate of the event.
Replaced by MouseEvent.getX() |
public int | yThe y coordinate of the event.
Replaced by MouseEvent.getY() |
public int | keyThe key code of the key that was pressed in a keyboard event.
This has been replaced by KeyEvent.getKeyCode() |
public int | modifiersThe state of the modifier keys.
This is replaced with InputEvent.getModifiers()
In java 1.1 MouseEvent and KeyEvent are subclasses
of InputEvent. |
public int | clickCountFor 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(). |
public Object | argAn arbitrary argument of the event. The value of this field
depends on the type of event.
arg has been replaced by event specific property. |
public Event | evtThe next event. This field is set when putting events into a
linked list.
This has been replaced by EventQueue. |
private static final int[] | actionKeyCodes |
private boolean | consumedThis field controls whether or not the event is sent back
down to the peer once the target has processed it -
false means it's sent to the peer, true means it's not. |
private static final long | serialVersionUID |
Constructors Summary |
---|
public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)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.
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
this.target = target;
this.when = when;
this.id = id;
this.x = x;
this.y = y;
this.key = key;
this.modifiers = modifiers;
this.arg = arg;
this.data = 0;
this.clickCount = 0;
switch(id) {
case ACTION_EVENT:
case WINDOW_DESTROY:
case WINDOW_ICONIFY:
case WINDOW_DEICONIFY:
case WINDOW_MOVED:
case SCROLL_LINE_UP:
case SCROLL_LINE_DOWN:
case SCROLL_PAGE_UP:
case SCROLL_PAGE_DOWN:
case SCROLL_ABSOLUTE:
case SCROLL_BEGIN:
case SCROLL_END:
case LIST_SELECT:
case LIST_DESELECT:
consumed = true; // these types are not passed back to peer
break;
default:
}
|
public Event(Object target, long when, int id, int x, int y, int key, int modifiers)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 .
this(target, when, id, x, y, key, modifiers, null);
|
public Event(Object target, int id, Object arg)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.
this(target, 0, id, 0, 0, 0, 0, arg);
|
Methods Summary |
---|
void | consume()NOTE: The Event class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent class and its subclasses.
switch(id) {
case KEY_PRESS:
case KEY_RELEASE:
case KEY_ACTION:
case KEY_ACTION_RELEASE:
consumed = true;
break;
default:
// event type cannot be consumed
}
|
public boolean | controlDown()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.
return (modifiers & CTRL_MASK) != 0;
|
char | getKeyEventChar()
for (int i = 0; i < actionKeyCodes.length; i++) {
if (actionKeyCodes[i][1] == key) {
return KeyEvent.CHAR_UNDEFINED;
}
}
return (char)key;
|
static int | getOldEventKey(java.awt.event.KeyEvent e)
int keyCode = e.getKeyCode();
for (int i = 0; i < actionKeyCodes.length; i++) {
if (actionKeyCodes[i][0] == keyCode) {
return actionKeyCodes[i][1];
}
}
return (int)e.getKeyChar();
|
private static native void | initIDs()Initialize JNI field and method IDs for fields that may be
accessed from C.
|
boolean | isConsumed()NOTE: The Event class is obsolete and is
available only for backwards compatilibility. It has been replaced
by the AWTEvent class and its subclasses.
return consumed;
|
public boolean | metaDown()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.
return (modifiers & META_MASK) != 0;
|
protected java.lang.String | paramString()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 .
String str = "id=" + id + ",x=" + x + ",y=" + y;
if (key != 0) {
str += ",key=" + key;
}
if (shiftDown()) {
str += ",shift";
}
if (controlDown()) {
str += ",control";
}
if (metaDown()) {
str += ",meta";
}
if (target != null) {
str += ",target=" + target;
}
if (arg != null) {
str += ",arg=" + arg;
}
return str;
|
public boolean | shiftDown()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.
return (modifiers & SHIFT_MASK) != 0;
|
public java.lang.String | toString()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.
return getClass().getName() + "[" + paramString() + "]";
|
public void | translate(int dx, int dy)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.
this.x += dx;
this.y += dy;
|