2362N/A * Copyright (c) 1995, 2002, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * <code>Event</code> is a platform-independent class that 0N/A * encapsulates events from the platform's Graphical User 0N/A * Interface in the Java 1.0 event model. In Java 1.1 0N/A * and later versions, the <code>Event</code> class is maintained 0N/A * only for backwards compatibilty. The information in this 0N/A * class description is provided to assist programmers in 0N/A * converting Java 1.0 programs to the new event model. 0N/A * In the Java 1.0 event model, an event contains an 0N/A * {@link Event#id} field 0N/A * that indicates what type of event it is and which other 0N/A * <code>Event</code> variables are relevant for the event. 0N/A * For keyboard events, {@link Event#key} 0N/A * contains a value indicating which key was activated, and 0N/A * {@link Event#modifiers} contains the 0N/A * modifiers for that event. For the KEY_PRESS and KEY_RELEASE 0N/A * event ids, the value of <code>key</code> is the unicode 0N/A * character code for the key. For KEY_ACTION and 0N/A * KEY_ACTION_RELEASE, the value of <code>key</code> is 0N/A * one of the defined action-key identifiers in the 0N/A * <code>Event</code> class (<code>PGUP</code>, 0N/A * <code>PGDN</code>, <code>F1</code>, <code>F2</code>, etc). 0N/A * @author Sami Shaio 0N/A /* Modifier constants */ 0N/A * This flag indicates that the Shift key was down when the event 0N/A * This flag indicates that the Control key was down when the event 0N/A * This flag indicates that the Meta key was down when the event 0N/A * occurred. For mouse events, this flag indicates that the right 0N/A * button was pressed or released. 0N/A * This flag indicates that the Alt key was down when 0N/A * the event occurred. For mouse events, this flag indicates that the 0N/A * middle mouse button was pressed or released. 0N/A * The Home key, a non-ASCII action key. 0N/A public static final int HOME =
1000;
0N/A * The End key, a non-ASCII action key. 0N/A public static final int END =
1001;
0N/A * The Page Up key, a non-ASCII action key. 0N/A public static final int PGUP =
1002;
0N/A * The Page Down key, a non-ASCII action key. 0N/A public static final int PGDN =
1003;
0N/A * The Up Arrow key, a non-ASCII action key. 0N/A public static final int UP =
1004;
0N/A * The Down Arrow key, a non-ASCII action key. 0N/A public static final int DOWN =
1005;
0N/A * The Left Arrow key, a non-ASCII action key. 0N/A public static final int LEFT =
1006;
0N/A * The Right Arrow key, a non-ASCII action key. 0N/A * The F1 function key, a non-ASCII action key. 0N/A public static final int F1 =
1008;
0N/A * The F2 function key, a non-ASCII action key. 0N/A public static final int F2 =
1009;
0N/A * The F3 function key, a non-ASCII action key. 0N/A public static final int F3 =
1010;
0N/A * The F4 function key, a non-ASCII action key. 0N/A public static final int F4 =
1011;
0N/A * The F5 function key, a non-ASCII action key. 0N/A public static final int F5 =
1012;
0N/A * The F6 function key, a non-ASCII action key. 0N/A public static final int F6 =
1013;
0N/A * The F7 function key, a non-ASCII action key. 0N/A public static final int F7 =
1014;
0N/A * The F8 function key, a non-ASCII action key. 0N/A public static final int F8 =
1015;
0N/A * The F9 function key, a non-ASCII action key. 0N/A public static final int F9 =
1016;
0N/A * The F10 function key, a non-ASCII action key. 0N/A public static final int F10 =
1017;
0N/A * The F11 function key, a non-ASCII action key. 0N/A public static final int F11 =
1018;
0N/A * The F12 function key, a non-ASCII action key. 0N/A public static final int F12 =
1019;
0N/A * The Print Screen key, a non-ASCII action key. 0N/A * The Scroll Lock key, a non-ASCII action key. 0N/A * The Caps Lock key, a non-ASCII action key. 0N/A * The Num Lock key, a non-ASCII action key. 0N/A * The Pause key, a non-ASCII action key. 0N/A * The Insert key, a non-ASCII action key. 0N/A /* Non-action keys */ 0N/A * The BackSpace key. 0N/A public static final int TAB =
'\t';
0N/A /* Base for all window events. */ 0N/A * The user has asked the window manager to kill the window. 0N/A * The user has asked the window manager to expose the window. 0N/A * The user has asked the window manager to iconify the window. 0N/A * The user has asked the window manager to de-iconify the window. 0N/A * The user has asked the window manager to move the window. 0N/A /* Base for all keyboard events. */ 0N/A * The user has pressed a normal key. 0N/A * The user has released a normal key. 0N/A * The user has pressed a non-ASCII <em>action</em> key. 0N/A * The <code>key</code> field contains a value that indicates 0N/A * that the event occurred on one of the action keys, which 0N/A * comprise the 12 function keys, the arrow (cursor) keys, 0N/A * Page Up, Page Down, Home, End, Print Screen, Scroll Lock, 0N/A * Caps Lock, Num Lock, Pause, and Insert. 0N/A * The user has released a non-ASCII <em>action</em> key. 0N/A * The <code>key</code> field contains a value that indicates 0N/A * that the event occurred on one of the action keys, which 0N/A * comprise the 12 function keys, the arrow (cursor) keys, 0N/A * Page Up, Page Down, Home, End, Print Screen, Scroll Lock, 0N/A * Caps Lock, Num Lock, Pause, and Insert. 0N/A /* Base for all mouse events. */ 0N/A * The user has pressed the mouse button. The <code>ALT_MASK</code> 0N/A * flag indicates that the middle button has been pressed. 0N/A * The <code>META_MASK</code>flag indicates that the 0N/A * right button has been pressed. 0N/A * @see java.awt.Event#ALT_MASK 0N/A * @see java.awt.Event#META_MASK 0N/A * The user has released the mouse button. The <code>ALT_MASK</code> 0N/A * flag indicates that the middle button has been released. 0N/A * The <code>META_MASK</code>flag indicates that the 0N/A * right button has been released. 0N/A * @see java.awt.Event#ALT_MASK 0N/A * @see java.awt.Event#META_MASK 0N/A * The mouse has moved with no button pressed. 0N/A * The mouse has entered a component. 0N/A * The mouse has exited a component. 0N/A * The user has moved the mouse with a button pressed. The 0N/A * <code>ALT_MASK</code> flag indicates that the middle 0N/A * button is being pressed. The <code>META_MASK</code> flag indicates 0N/A * that the right button is being pressed. 0N/A * @see java.awt.Event#ALT_MASK 0N/A * @see java.awt.Event#META_MASK 0N/A /* Scrolling events */ 0N/A * The user has activated the <em>line up</em> 0N/A * area of a scroll bar. 0N/A * The user has activated the <em>line down</em> 0N/A * area of a scroll bar. 0N/A * The user has activated the <em>page up</em> 0N/A * area of a scroll bar. 0N/A * The user has activated the <em>page down</em> 0N/A * area of a scroll bar. 0N/A * The user has moved the bubble (thumb) in a scroll bar, 0N/A * moving to an "absolute" position, rather than to 0N/A * an offset from the last postion. 0N/A * The scroll begin event. 0N/A * The scroll end event. 0N/A * An item in a list has been selected. 0N/A * An item in a list has been deselected. 0N/A * This event indicates that the user wants some action to occur. 0N/A * A file loading event. 0N/A * A file saving event. 0N/A * A component gained the focus. 0N/A * A component lost the focus. 0N/A * The target component. This indicates the component over which the 0N/A * event occurred or with which the event is associated. 0N/A * This object has been replaced by AWTEvent.getSource() 0N/A * @see java.awt.AWTEvent#getSource() 0N/A * Replaced by InputEvent.getWhen(). 0N/A * @see java.awt.event.InputEvent#getWhen() 0N/A * Indicates which type of event the event is, and which 0N/A * other <code>Event</code> variables are relevant for the event. 0N/A * This has been replaced by AWTEvent.getID() 0N/A * @see java.awt.AWTEvent#getID() 0N/A * The <i>x</i> coordinate of the event. 0N/A * Replaced by MouseEvent.getX() 0N/A * @see java.awt.event.MouseEvent#getX() 0N/A * The <i>y</i> coordinate of the event. 0N/A * Replaced by MouseEvent.getY() 0N/A * @see java.awt.event.MouseEvent#getY() 0N/A * The key code of the key that was pressed in a keyboard event. 0N/A * This has been replaced by KeyEvent.getKeyCode() 0N/A * @see java.awt.event.KeyEvent#getKeyCode() 0N/A * The key character that was pressed in a keyboard event. 0N/A// public char keyChar; 0N/A * The state of the modifier keys. 0N/A * This is replaced with InputEvent.getModifiers() 0N/A * In java 1.1 MouseEvent and KeyEvent are subclasses 0N/A * @see java.awt.event.InputEvent#getModifiers() 0N/A * For <code>MOUSE_DOWN</code> events, this field indicates the 0N/A * number of consecutive clicks. For other events, its value is 0N/A * This field has been replaced by MouseEvent.getClickCount(). 0N/A * @see java.awt.event.MouseEvent#getClickCount(). 0N/A * An arbitrary argument of the event. The value of this field 0N/A * depends on the type of event. 0N/A * <code>arg</code> has been replaced by event specific property. 0N/A * The next event. This field is set when putting events into a 0N/A * This has been replaced by EventQueue. 0N/A * @see java.awt.EventQueue 0N/A /* table for mapping old Event action keys to KeyEvent virtual keys. */ 0N/A /* virtual key action key */ 0N/A * This field controls whether or not the event is sent back 0N/A * down to the peer once the target has processed it - 0N/A * false means it's sent to the peer, true means it's not. 0N/A * @see #isConsumed() 0N/A * JDK 1.1 serialVersionUID 0N/A /* ensure that the necessary native libraries are loaded */ 0N/A * Initialize JNI field and method IDs for fields that may be 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Creates an instance of <code>Event</code> with the specified target 0N/A * component, time stamp, event type, <i>x</i> and <i>y</i> 0N/A * coordinates, keyboard key, state of the modifier keys, and 0N/A * @param target the target component. 0N/A * @param when the time stamp. 0N/A * @param id the event type. 0N/A * @param x the <i>x</i> coordinate. 0N/A * @param y the <i>y</i> coordinate. 0N/A * @param key the key pressed in a keyboard event. 0N/A * @param modifiers the state of the modifier keys. 0N/A * @param arg the specified argument. 0N/A consumed =
true;
// these types are not passed back to peer 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Creates an instance of <code>Event</code>, with the specified target 0N/A * component, time stamp, event type, <i>x</i> and <i>y</i> 0N/A * coordinates, keyboard key, state of the modifier keys, and an 0N/A * argument set to <code>null</code>. 0N/A * @param target the target component. 0N/A * @param when the time stamp. 0N/A * @param id the event type. 0N/A * @param x the <i>x</i> coordinate. 0N/A * @param y the <i>y</i> coordinate. 0N/A * @param key the key pressed in a keyboard event. 0N/A * @param modifiers the state of the modifier keys. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Creates an instance of <code>Event</code> with the specified 0N/A * target component, event type, and argument. 0N/A * @param target the target component. 0N/A * @param id the event type. 0N/A * @param arg the specified argument. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Translates this event so that its <i>x</i> and <i>y</i> 0N/A * coordinates are increased by <i>dx</i> and <i>dy</i>, 0N/A * This method translates an event relative to the given component. 0N/A * This involves, at a minimum, translating the coordinates into the 0N/A * local coordinate system of the given component. It may also involve 0N/A * translating a region in the case of an expose event. 0N/A * @param dx the distance to translate the <i>x</i> coordinate. 0N/A * @param dy the distance to translate the <i>y</i> coordinate. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Checks if the Shift key is down. 0N/A * @return <code>true</code> if the key is down; 0N/A * <code>false</code> otherwise. 0N/A * @see java.awt.Event#modifiers 0N/A * @see java.awt.Event#controlDown 0N/A * @see java.awt.Event#metaDown 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Checks if the Control key is down. 0N/A * @return <code>true</code> if the key is down; 0N/A * <code>false</code> otherwise. 0N/A * @see java.awt.Event#modifiers 0N/A * @see java.awt.Event#shiftDown 0N/A * @see java.awt.Event#metaDown 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Checks if the Meta key is down. 0N/A * @return <code>true</code> if the key is down; 0N/A * <code>false</code> otherwise. 0N/A * @see java.awt.Event#modifiers 0N/A * @see java.awt.Event#shiftDown 0N/A * @see java.awt.Event#controlDown 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A // event type cannot be consumed 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Returns the integer key-code associated with the key in this event, 0N/A * as described in java.awt.Event. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Returns a new KeyEvent char which corresponds to the int key 0N/A * of this old event. 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Returns a string representing the state of this <code>Event</code>. 0N/A * This method is intended to be used only for debugging purposes, and the 0N/A * content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not be 0N/A * <code>null</code>. 0N/A * @return the parameter string of this event 0N/A * <b>NOTE:</b> The <code>Event</code> class is obsolete and is 0N/A * available only for backwards compatilibility. It has been replaced 0N/A * by the <code>AWTEvent</code> class and its subclasses. 0N/A * Returns a representation of this event's values as a string. 0N/A * @return a string that represents the event and the values 0N/A * of its member fields. 0N/A * @see java.awt.Event#paramString