/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* <code>Event</code> 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 <code>Event</code> 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.
* <p>
* In the Java 1.0 event model, an event contains an
* {@link Event#id} field
* that indicates what type of event it is and which other
* <code>Event</code> variables are relevant for the event.
* <p>
* For keyboard events, {@link Event#key}
* contains a value indicating which key was activated, and
* {@link Event#modifiers} contains the
* modifiers for that event. For the KEY_PRESS and KEY_RELEASE
* event ids, the value of <code>key</code> is the unicode
* character code for the key. For KEY_ACTION and
* KEY_ACTION_RELEASE, the value of <code>key</code> is
* one of the defined action-key identifiers in the
* <code>Event</code> class (<code>PGUP</code>,
* <code>PGDN</code>, <code>F1</code>, <code>F2</code>, etc).
*
* @author Sami Shaio
* @since JDK1.0
*/
private transient long data;
/* Modifier constants */
/**
* This flag indicates that the Shift key was down when the event
* occurred.
*/
/**
* This flag indicates that the Control key was down when the event
* occurred.
*/
/**
* This 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.
*/
/**
* This 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.
*/
/* Action keys */
/**
* The Home key, a non-ASCII action key.
*/
/**
* The End key, a non-ASCII action key.
*/
/**
* The Page Up key, a non-ASCII action key.
*/
/**
* The Page Down key, a non-ASCII action key.
*/
/**
* The Up Arrow key, a non-ASCII action key.
*/
/**
* The Down Arrow key, a non-ASCII action key.
*/
/**
* The Left Arrow key, a non-ASCII action key.
*/
/**
* The Right Arrow key, a non-ASCII action key.
*/
/**
* The F1 function key, a non-ASCII action key.
*/
/**
* The F2 function key, a non-ASCII action key.
*/
/**
* The F3 function key, a non-ASCII action key.
*/
/**
* The F4 function key, a non-ASCII action key.
*/
/**
* The F5 function key, a non-ASCII action key.
*/
/**
* The F6 function key, a non-ASCII action key.
*/
/**
* The F7 function key, a non-ASCII action key.
*/
/**
* The F8 function key, a non-ASCII action key.
*/
/**
* The F9 function key, a non-ASCII action key.
*/
/**
* The F10 function key, a non-ASCII action key.
*/
/**
* The F11 function key, a non-ASCII action key.
*/
/**
* The F12 function key, a non-ASCII action key.
*/
/**
* The Print Screen key, a non-ASCII action key.
*/
/**
* The Scroll Lock key, a non-ASCII action key.
*/
/**
* The Caps Lock key, a non-ASCII action key.
*/
/**
* The Num Lock key, a non-ASCII action key.
*/
/**
* The Pause key, a non-ASCII action key.
*/
/**
* The Insert key, a non-ASCII action key.
*/
/* Non-action keys */
/**
* The Enter key.
*/
/**
* The BackSpace key.
*/
/**
* The Tab key.
*/
/**
* The Escape key.
*/
/**
* The Delete key.
*/
/* Base for all window events. */
/**
* The user has asked the window manager to kill the window.
*/
/**
* The user has asked the window manager to expose the window.
*/
/**
* The user has asked the window manager to iconify the window.
*/
/**
* The user has asked the window manager to de-iconify the window.
*/
/**
* The user has asked the window manager to move the window.
*/
/* Base for all keyboard events. */
/**
* The user has pressed a normal key.
*/
/**
* The user has released a normal key.
*/
/**
* The user has pressed a non-ASCII <em>action</em> key.
* The <code>key</code> 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.
*/
/**
* The user has released a non-ASCII <em>action</em> key.
* The <code>key</code> 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.
*/
/* Base for all mouse events. */
/**
* The user has pressed the mouse button. The <code>ALT_MASK</code>
* flag indicates that the middle button has been pressed.
* The <code>META_MASK</code>flag indicates that the
* right button has been pressed.
* @see java.awt.Event#ALT_MASK
* @see java.awt.Event#META_MASK
*/
/**
* The user has released the mouse button. The <code>ALT_MASK</code>
* flag indicates that the middle button has been released.
* The <code>META_MASK</code>flag indicates that the
* right button has been released.
* @see java.awt.Event#ALT_MASK
* @see java.awt.Event#META_MASK
*/
/**
* The mouse has moved with no button pressed.
*/
/**
* The mouse has entered a component.
*/
/**
* The mouse has exited a component.
*/
/**
* The user has moved the mouse with a button pressed. The
* <code>ALT_MASK</code> flag indicates that the middle
* button is being pressed. The <code>META_MASK</code> flag indicates
* that the right button is being pressed.
* @see java.awt.Event#ALT_MASK
* @see java.awt.Event#META_MASK
*/
/* Scrolling events */
/**
* The user has activated the <em>line up</em>
* area of a scroll bar.
*/
/**
* The user has activated the <em>line down</em>
* area of a scroll bar.
*/
/**
* The user has activated the <em>page up</em>
* area of a scroll bar.
*/
/**
* The user has activated the <em>page down</em>
* area of a scroll bar.
*/
/**
* The user has moved the bubble (thumb) in a scroll bar,
* moving to an "absolute" position, rather than to
* an offset from the last postion.
*/
/**
* The scroll begin event.
*/
/**
* The scroll end event.
*/
/* List Events */
/**
* An item in a list has been selected.
*/
/**
* An item in a list has been deselected.
*/
/* Misc Event */
/**
* This event indicates that the user wants some action to occur.
*/
/**
* A file loading event.
*/
/**
* A file saving event.
*/
/**
* A component gained the focus.
*/
/**
* A component lost the focus.
*/
/**
* The 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()
*
* @serial
* @see java.awt.AWTEvent#getSource()
*/
/**
* The time stamp.
* Replaced by InputEvent.getWhen().
*
* @serial
* @see java.awt.event.InputEvent#getWhen()
*/
public long when;
/**
* Indicates which type of event the event is, and which
* other <code>Event</code> variables are relevant for the event.
* This has been replaced by AWTEvent.getID()
*
* @serial
* @see java.awt.AWTEvent#getID()
*/
public int id;
/**
* The <i>x</i> coordinate of the event.
* Replaced by MouseEvent.getX()
*
* @serial
* @see java.awt.event.MouseEvent#getX()
*/
public int x;
/**
* The <i>y</i> coordinate of the event.
* Replaced by MouseEvent.getY()
*
* @serial
* @see java.awt.event.MouseEvent#getY()
*/
public int y;
/**
* The key code of the key that was pressed in a keyboard event.
* This has been replaced by KeyEvent.getKeyCode()
*
* @serial
* @see java.awt.event.KeyEvent#getKeyCode()
*/
public int key;
/**
* The key character that was pressed in a keyboard event.
*/
// public char keyChar;
/**
* The state of the modifier keys.
* This is replaced with InputEvent.getModifiers()
* In java 1.1 MouseEvent and KeyEvent are subclasses
* of InputEvent.
*
* @serial
* @see java.awt.event.InputEvent#getModifiers()
*/
public int modifiers;
/**
* For <code>MOUSE_DOWN</code> events, this field indicates the
* number of consecutive clicks. For other events, its value is
* <code>0</code>.
* This field has been replaced by MouseEvent.getClickCount().
*
* @serial
* @see java.awt.event.MouseEvent#getClickCount().
*/
public int clickCount;
/**
* An arbitrary argument of the event. The value of this field
* depends on the type of event.
* <code>arg</code> has been replaced by event specific property.
*
* @serial
*/
/**
* The next event. This field is set when putting events into a
* linked list.
* This has been replaced by EventQueue.
*
* @serial
* @see java.awt.EventQueue
*/
/* table for mapping old Event action keys to KeyEvent virtual keys. */
private static final int actionKeyCodes[][] = {
/* virtual key action key */
};
/**
* This 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.
*
* @serial
* @see #isConsumed()
*/
private boolean consumed = false;
/*
* JDK 1.1 serialVersionUID
*/
static {
/* ensure that the necessary native libraries are loaded */
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Initialize JNI field and method IDs for fields that may be
accessed from C.
*/
private static native void initIDs();
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Creates an instance of <code>Event</code> with the specified target
* component, time stamp, event type, <i>x</i> and <i>y</i>
* coordinates, keyboard key, state of the modifier keys, and
* argument.
* @param target the target component.
* @param when the time stamp.
* @param id the event type.
* @param x the <i>x</i> coordinate.
* @param y the <i>y</i> coordinate.
* @param key the key pressed in a keyboard event.
* @param modifiers the state of the modifier keys.
* @param arg the specified argument.
*/
this.x = x;
this.y = y;
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:
}
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Creates an instance of <code>Event</code>, with the specified target
* component, time stamp, event type, <i>x</i> and <i>y</i>
* coordinates, keyboard key, state of the modifier keys, and an
* argument set to <code>null</code>.
* @param target the target component.
* @param when the time stamp.
* @param id the event type.
* @param x the <i>x</i> coordinate.
* @param y the <i>y</i> coordinate.
* @param key the key pressed in a keyboard event.
* @param modifiers the state of the modifier keys.
*/
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Creates an instance of <code>Event</code> with the specified
* target component, event type, and argument.
* @param target the target component.
* @param id the event type.
* @param arg the specified argument.
*/
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Translates this event so that its <i>x</i> and <i>y</i>
* coordinates are increased by <i>dx</i> and <i>dy</i>,
* respectively.
* <p>
* 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.
* @param dx the distance to translate the <i>x</i> coordinate.
* @param dy the distance to translate the <i>y</i> coordinate.
*/
this.x += dx;
this.y += dy;
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Checks if the Shift key is down.
* @return <code>true</code> if the key is down;
* <code>false</code> otherwise.
* @see java.awt.Event#modifiers
* @see java.awt.Event#controlDown
* @see java.awt.Event#metaDown
*/
public boolean shiftDown() {
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Checks if the Control key is down.
* @return <code>true</code> if the key is down;
* <code>false</code> otherwise.
* @see java.awt.Event#modifiers
* @see java.awt.Event#shiftDown
* @see java.awt.Event#metaDown
*/
public boolean controlDown() {
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Checks if the Meta key is down.
*
* @return <code>true</code> if the key is down;
* <code>false</code> otherwise.
* @see java.awt.Event#modifiers
* @see java.awt.Event#shiftDown
* @see java.awt.Event#controlDown
*/
public boolean metaDown() {
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
*/
void consume() {
switch(id) {
case KEY_PRESS:
case KEY_RELEASE:
case KEY_ACTION:
case KEY_ACTION_RELEASE:
consumed = true;
break;
default:
// event type cannot be consumed
}
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
*/
boolean isConsumed() {
return consumed;
}
/*
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Returns the integer key-code associated with the key in this event,
* as described in java.awt.Event.
*/
int keyCode = e.getKeyCode();
return actionKeyCodes[i][1];
}
}
return (int)e.getKeyChar();
}
/*
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Returns a new KeyEvent char which corresponds to the int key
* of this old event.
*/
char getKeyEventChar() {
return KeyEvent.CHAR_UNDEFINED;
}
}
return (char)key;
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Returns a string representing the state of this <code>Event</code>.
* 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
* <code>null</code>.
*
* @return the parameter string of this event
*/
if (key != 0) {
}
if (shiftDown()) {
str += ",shift";
}
if (controlDown()) {
str += ",control";
}
if (metaDown()) {
str += ",meta";
}
}
}
return str;
}
/**
* <b>NOTE:</b> The <code>Event</code> class is obsolete and is
* available only for backwards compatilibility. It has been replaced
* by the <code>AWTEvent</code> class and its subclasses.
* <p>
* Returns a representation of this event's values as a string.
* @return a string that represents the event and the values
* of its member fields.
* @see java.awt.Event#paramString
* @since JDK1.1
*/
}
}