EventNameEvent
DescriptionThe 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. Class Definition
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(); } ConstantsACTION_EVENTpublic static final int ACTION_EVENTID constant for Action Event. ALT_MASKpublic static final int ALT_MASKMask for ALT key. BACK_SPACEpublic static final int BACK_SPACEID constant for Backspace. CAPS_LOCKpublic static final int CAPS_LOCKID constant for Caps Lock key. CTRL_MASKpublic static final int CTRL_MASKMask for Control key. DELETEpublic static final int DELETEID constant for Delete. DOWNpublic static final int DOWNID constant for the down arrow key. ENDpublic static final int ENDID constant for End key. ENTERpublic static final int ENTERID constant for Enter key. ESCAPEpublic static final int ESCAPEID constant for Escape key. F1public static final int F1ID constant for F1 key. F2public static final int F2ID constant for F2 key. F3public static final int F3ID constant for F3 key. F4public static final int F4ID constant for F4 key. F5public static final int F5ID constant for F5 key. F6public static final int F6ID constant for F6 key. F7public static final int F7ID constant for F7 key. F8public static final int F8ID constant for F8 key. F9public static final int F9ID constant for F9 key. F10public static final int F10ID constant for F10 key. F11public static final int F11ID constant for F11 key. F12public static final int F12ID constant for F12 key. GOT_FOCUSpublic static final int GOT_FOCUSID constant for getting input focus Event. HOMEpublic static final int HOMEID constant for Home key. INSERTpublic static final int INSERTID constant for Insert key. KEY_ACTIONpublic static final int KEY_ACTIONID constant for Special Key Down Event. KEY_ACTION_RELEASEpublic static final int KEY_ACTION_RELEASEID constant for Special Key Up Event. KEY_PRESSpublic static final int KEY_PRESSID constant for Key Down Event. KEY_RELEASEpublic static final int KEY_RELEASEID constant for Key Up Event. LEFTpublic static final int LEFTID constant for the left arrow key. LIST_DESELECTpublic static final int LIST_DESELECTID constant for List DeSelect Event. LIST_SELECTpublic static final int LIST_SELECTID constant for List Select Event. LOAD_FILEpublic static final int LOAD_FILEID constant for File Load Event. LOST_FOCUSpublic static final int LOST_FOCUSID constant for losing input focus Event. META_MASKpublic static final int META_MASKMask for ALT key. MOUSE_DOWNpublic static final int MOUSE_DOWNID constant for Mouse Down Event. MOUSE_DRAGpublic static final int MOUSE_DRAGID constant for Mouse Drag Event. MOUSE_ENTERpublic static final int MOUSE_ENTERID constant for Mouse Enter Event. MOUSE_EXITpublic static final int MOUSE_EXITID constant for Mouse Exit Event. MOUSE_MOVEpublic static final int MOUSE_MOVEID constant for Mouse Move Event. MOUSE_UPpublic static final int MOUSE_UPID constant for Mouse Up Event. NUM_LOCKpublic static final int NUM_LOCKID constant for Num Lock key. PAUSEpublic static final int PAUSEID constant for Pause key. PGDNpublic static final int PGDNID constant for PageDown key. PGUPpublic static final int PGUPID constant for PageUp key. PRINT_SCREENpublic static final int PRINT_SCREENID constant for Print Screen key. RIGHTpublic static final int RIGHTID constant for the right arrow key. SAVE_FILEpublic static final int SAVE_FILEID constant for File Save Event. SCROLL_ABSOLUTEpublic static final int SCROLL_ABSOLUTEID constant for Absolute Scroll Event. SCROLL_BEGINpublic static final int SCROLL_ BEGINID constant for Begin Scroll Event. SCROLL_ENDpublic static final int SCROLL_ ENDID constant for End Scroll Event. SCROLL_LINE_DOWNpublic static final int SCROLL_LINE_DOWNID constant for Line Down Scroll Event. SCROLL_LINE_UPpublic static final int SCROLL_LINE_UPID constant for Line Up Scroll Event. SCROLL_LOCKpublic static final int SCROLL_LOCKMask for Scroll Lock key. SCROLL_PAGE_DOWNpublic static final int SCROLL_PAGE_DOWNID constant for Page Down Scroll Event. SCROLL_PAGE_UPpublic static final int SCROLL_PAGE_UPID constant for Page Up Scroll Event. SHIFT_MASKpublic static final int SHIFT_MASKMask for SHIFT key. TABpublic static final int TABID constant for Tab key. UPpublic static final int UPID constant for the up arrow key. WINDOW_DEICONIFYpublic static final int WINDOW_DEICONIFYID constant for Window DeIconify Event. WINDOW_DESTROYpublic static final int WINDOW_DESTROYID constant for Window Destroy Event. WINDOW_EXPOSEpublic static final int WINDOW_EXPOSEID constant for Window Expose Event. WINDOW_ICONIFYpublic static final int WINDOW_ICONIFYID constant for Window Iconify Event. WINDOW_MOVEDpublic static final int WINDOW_MOVEDID constant for Window Move Event. Variablesargpublic Object argA variable argument that is specific to the event type. clickCountpublic int clickCountThe number of consecutive MOUSE_DOWN events. evtpublic Event evtA means of passing a linked list of events as one. idpublic int idThe ID constant that identifies the Event type. keypublic int keyInteger value of key pressed, or ID constant identifying a special key. modifierspublic int modifiersThe state of the shift/alt/control/meta keys, formed by ORing the masks for the appropriate keys. targetpublic Object targetThe Object that generated the event. whenpublic long whenThe time the event happened. xpublic int xThe x position at which the event happened. ypublic int yThe y position at which the event happened. ConstructorsEventpublic 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 MethodscontrolDownpublic boolean controlDown()
metaDownpublic boolean metaDown()
shiftDownpublic boolean shiftDown()
toStringpublic String toString()
translatepublic void translate (int x, int y)
Protected Instance MethodsparamStringprotected String paramString()
See AlsoAWTEvent, Component, Object, String |
|