
 |
Chapter 19 java.awt Reference |
 |
Event
Name
Event
The Event class represents
events that happen within the Java environment in a platform independent
way. Events typically represent user actions, like typing a key or clicking
the mouse. Although this class has been updated for the 1.1 release, it
is only used for the 1.0 event model. When using the 1.1 event model, all
events are represented by subclasses of java.awt.AWTEvent.
public class java.awt.Event
extends java.lang.Object
implements java.io.Serializable {
// Constants
public static final int ACTION_EVENT;
public static final int ALT_MASK;
public static final int BACK_SPACE;
public static final int CAPS_LOCK;
public static final int CTRL_MASK;
public static final int DELETE;
public static final int DOWN;
public static final int END;
public static final int ENTER;
public static final int ESCAPE;
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 GOT_FOCUS;
public static final int HOME;
public static final int INSERT;
public static final int KEY_ACTION;
public static final int KEY_ACTION_RELEASE;
public static final int KEY_PRESS;
public static final int KEY_RELEASE;
public static final int LEFT;
public static final int LIST_DESELECT;
public static final int LIST_SELECT;
public static final int LOAD_FILE;
public static final int LOST_FOCUS;
public static final int META_MASK;
public static final int MOUSE_DOWN;
public static final int MOUSE_DRAG;
public static final int MOUSE_ENTER;
public static final int MOUSE_EXIT;
public static final int MOUSE_MOVE;
public static final int MOUSE_UP;
public static final int NUM_LOCK;
public static final int PAUSE;
public static final int PGDN;
public static final int PGUP;
public static final int PRINT_SCREEN;
public static final int RIGHT;
public static final int SAVE_FILE;
public static final int SCROLL_ABSOLUTE;
public static final int SCROLL_BEGIN;
public static final int SCROLL_END;
public static final int SCROLL_LINE_DOWN;
public static final int SCROLL_LINE_UP;
public static final int SCROLL_LOCK;
public static final int SCROLL_PAGE_DOWN;
public static final int SCROLL_PAGE_UP;
public static final int SHIFT_MASK;
public static final int TAB;
public static final int UP;
public static final int WINDOW_DEICONIFY;
public static final int WINDOW_DESTROY;
public static final int WINDOW_EXPOSE;
public static final int WINDOW_ICONIFY;
public static final int WINDOW_MOVED;
// Variables
public Object arg;
public int clickCount;
public Event evt;
public int id;
public int key;
public int modifiers;
public Object target;
public long when;
public int x;
public int y;
// Constructors
public Event (Object target, int id, Object arg);
public Event (Object target, long when, int id, int x, int y,
int key, int modifiers);
public Event (Object target, long when, int id, int x, int y,
int key, int modifiers, Object arg);
// Instance Methods
public boolean controlDown();
public boolean metaDown();
public boolean shiftDown();
public String toString();
public void translate (int x, int y);
// Protected Instance Methods
protected String paramString();
}
ID constant for Action Event.
ID constant for Backspace.
ID constant for Caps Lock key.
ID constant for the down arrow key.
ID constant for Enter key.
ID constant for Escape key.
ID constant for getting input focus Event.
ID constant for Home key.
ID constant for Insert key.
ID constant for Special Key Down Event.
ID constant for Special Key Up Event.
ID constant for Key Down Event.
ID constant for Key Up Event.
ID constant for the left arrow key.
ID constant for List DeSelect Event.
ID constant for List Select Event.
ID constant for File Load Event.
ID constant for losing input focus Event.
ID constant for Mouse Down Event.
ID constant for Mouse Drag Event.
ID constant for Mouse Enter Event.
ID constant for Mouse Exit Event.
ID constant for Mouse Move Event.
ID constant for Mouse Up Event.
ID constant for Num Lock key.
ID constant for Pause key.
ID constant for PageDown key.
ID constant for PageUp key.
ID constant for Print Screen key.
ID constant for the right arrow key.
ID constant for File Save Event.
ID constant for Absolute Scroll Event.
ID constant for Begin Scroll Event.
ID constant for End Scroll Event.
ID constant for Line Down Scroll Event.
ID constant for Line Up Scroll Event.
Mask for Scroll Lock key.
ID constant for Page Down Scroll Event.
ID constant for Page Up Scroll Event.
ID constant for the up arrow key.
ID constant for Window DeIconify Event.
ID constant for Window Destroy Event.
ID constant for Window Expose Event.
ID constant for Window Iconify Event.
ID constant for Window Move Event.
A variable argument that is specific to the event type.
The number of consecutive MOUSE_DOWN events.
A means of passing a linked list of events as one.
The ID constant that identifies the Event
type.
Integer value of key pressed, or ID constant identifying a special key.
The state of the shift/alt/control/meta keys, formed
by ORing the masks for the appropriate keys.
The Object that generated the
event.
The time the event happened.
The x position at which the event happened.
The y position at which the event happened.
- Parameters
-
- target
-
The component to which the Event
should be delivered
- id
-
The identifier of Event
- arg
-
The Object
that is the cause of the event
- Description
-
Constructs an Event object
with the given values.
- Parameters
-
- target
-
The component to which the Event
should be delivered
- when
-
The time the event happened
- id
-
The identifier of Event
- x
-
The x position at which the event happened
- y
-
The y position at which the event happened
- key
-
Integer value of key pressed, or a constant identifying
a special key
- modifiers
-
The state of the shift/alt/control/meta
keys
- Description
-
Constructs an Event object
with the given values.
- Parameters
-
- target
-
The component to which the Event
should be delivered
- when
-
The time the event happened
- id
-
The identifier of Event
- x
-
The x position at which the event happened
- y
-
The y position at which the event happened
- key
-
Integer value of key pressed, or a constant identifying
a special key
- modifiers
-
The state of the shift/alt/control/meta
keys
- arg
-
The Object
that is the cause of the event
- Description
-
Constructs an Event object
with the given values.
- Returns
-
true if the control key was
down when the event was triggered, false
otherwise.
- Description
-
Checks current settings for modifiers of the Event.
- Returns
-
true if the meta key was down
when the event was triggered, false
otherwise.
- Description
-
Checks current settings for modifiers of the Event.
- Returns
-
true if the shift key was down
when the event was triggered, false
otherwise.
- Description
-
Checks current settings for modifiers of the Event.
- Returns
-
A string representation of the Event
object.
- Overrides
-
Object.toString()
- Parameters
-
- x
-
Amount to move Event
in horizontal direction.
- y
-
Amount to move Event
in vertical direction.
- Description
-
Translates x and y coordinates of Event
instance by x and y.
- Returns
-
String with current settings of Event.
- Description
-
Helper method for toString()
to generate string of current settings.
AWTEvent, Component,
Object, String
|