FileDocCategorySizeDatePackage
Event.javaAPI DocAndroid 1.5 API15508Wed May 06 22:41:54 BST 2009java.awt

Event

public class Event extends Object implements Serializable
The Event class is obsolete and has been replaced by AWTEvent class.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
The Constant serialVersionUID.
public static final int
SHIFT_MASK
The Constant SHIFT_MASK indicates that the Shift key is down when the event occurred.
public static final int
CTRL_MASK
The Constant CTRL_MASK indicates that the Control key is down when the event occurred.
public static final int
META_MASK
The Constant META_MASK indicates that the Meta key is down when t he event occurred (or the right mouse button).
public static final int
ALT_MASK
The Constant ALT_MASK indicates that the Alt key is down when the event occurred (or the middle mouse button).
public static final int
HOME
The Constant HOME indicates Home key.
public static final int
END
The Constant END indicates End key.
public static final int
PGUP
The Constant PGUP indicates Page Up key.
public static final int
PGDN
The Constant PGDN indicates Page Down key.
public static final int
UP
The Constant UP indicates Up key.
public static final int
DOWN
The Constant DOWN indicates Down key.
public static final int
LEFT
The Constant LEFT indicates Left key.
public static final int
RIGHT
The Constant RIGHT indicates Right key.
public static final int
F1
The Constant F1 indicates F1 key.
public static final int
F2
The Constant F2 indicates F2 key.
public static final int
F3
The Constant F3 indicates F3 key.
public static final int
F4
The Constant F4 indicates F4 key.
public static final int
F5
The Constant F5 indicates F5 key.
public static final int
F6
The Constant F6 indicates F6 key.
public static final int
F7
The Constant F7 indicates F7 key.
public static final int
F8
The Constant F8 indicates F8 key.
public static final int
F9
The Constant F9 indicates F9 key.
public static final int
F10
The Constant F10 indicates F10 key.
public static final int
F11
The Constant F11 indicates F11 key.
public static final int
F12
The Constant F12 indicates F12 key.
public static final int
PRINT_SCREEN
The Constant PRINT_SCREEN indicates Print Screen key.
public static final int
SCROLL_LOCK
The Constant SCROLL_LOCK indicates Scroll Lock key.
public static final int
CAPS_LOCK
The Constant CAPS_LOCK indicates Caps Lock key.
public static final int
NUM_LOCK
The Constant NUM_LOCK indicates Num Lock key.
public static final int
PAUSE
The Constant PAUSE indicates Pause key.
public static final int
INSERT
The Constant INSERT indicates Insert key.
public static final int
ENTER
The Constant ENTER indicates Enter key.
public static final int
BACK_SPACE
The Constant BACK_SPACE indicates Back Space key.
public static final int
TAB
The Constant TAB indicates TAb key.
public static final int
ESCAPE
The Constant ESCAPE indicates Escape key.
public static final int
DELETE
The Constant DELETE indicates Delete key.
public static final int
WINDOW_DESTROY
The Constant WINDOW_DESTROY indicates an event when the user has asked the window manager to kill the window.
public static final int
WINDOW_EXPOSE
The Constant WINDOW_EXPOSE indicates an event when the user has asked the window manager to expose the window.
public static final int
WINDOW_ICONIFY
The Constant WINDOW_ICONIFY indicates an event when the user has asked the window manager to iconify the window.
public static final int
WINDOW_DEICONIFY
The Constant WINDOW_DEICONIFY indicates an event when the user has asked the window manager to deiconify the window.
public static final int
WINDOW_MOVED
The Constant WINDOW_MOVED indicates an event when the user has asked the window manager to move the window.
public static final int
KEY_PRESS
The Constant KEY_PRESS indicates an event when the user presses a normal key.
public static final int
KEY_RELEASE
The Constant KEY_RELEASE indicates an event when the user releases a normal key.
public static final int
KEY_ACTION
The Constant KEY_ACTION indicates an event when the user pressed a non-ASCII action key.
public static final int
KEY_ACTION_RELEASE
The Constant KEY_ACTION_RELEASE indicates an event when the user released a non-ASCII action key.
public static final int
MOUSE_DOWN
The Constant MOUSE_DOWN indicates an event when the user has pressed the mouse button.
public static final int
MOUSE_UP
The Constant MOUSE_UP indicates an event when the user has released the mouse button.
public static final int
MOUSE_MOVE
The Constant MOUSE_MOVE indicates an event when the user has moved the mouse with no button pressed.
public static final int
MOUSE_ENTER
The Constant MOUSE_ENTER indicates an event when the mouse has entered a component.
public static final int
MOUSE_EXIT
The Constant MOUSE_EXIT indicates an event when the mouse has exited a component.
public static final int
MOUSE_DRAG
The Constant MOUSE_DRAG indicates an event when the user has moved a mouse with the pressed button.
public static final int
SCROLL_LINE_UP
The Constant SCROLL_LINE_UP indicates an event when the user has activated line-up area of scrollbar.
public static final int
SCROLL_LINE_DOWN
The Constant SCROLL_LINE_DOWN indicates an event when the user has activated line-down area of scrollbar.
public static final int
SCROLL_PAGE_UP
The Constant SCROLL_PAGE_UP indicates an event when the user has activated page up area of scrollbar.
public static final int
SCROLL_PAGE_DOWN
The Constant SCROLL_PAGE_DOWN indicates an event when the user has activated page down area of scrollbar.
public static final int
SCROLL_ABSOLUTE
The Constant SCROLL_ABSOLUTE indicates an event when the user has moved the bubble in a scroll bar.
public static final int
SCROLL_BEGIN
The Constant SCROLL_BEGIN indicates a scroll begin event.
public static final int
SCROLL_END
The Constant SCROLL_END indicates a scroll end event.
public static final int
LIST_SELECT
The Constant LIST_SELECT indicates that an item in a list has been selected.
public static final int
LIST_DESELECT
The Constant LIST_DESELECT indicates that an item in a list has been unselected.
public static final int
ACTION_EVENT
The Constant ACTION_EVENT indicates that the user wants some action to occur.
public static final int
LOAD_FILE
The Constant LOAD_FILE indicates a file loading event.
public static final int
SAVE_FILE
The Constant SAVE_FILE indicates a file saving event.
public static final int
GOT_FOCUS
The Constant GOT_FOCUS indicates that a component got the focus.
public static final int
LOST_FOCUS
The Constant LOST_FOCUS indicates that the component lost the focus.
public Object
target
The target is the component with which the event is associated.
public long
when
The when is timestamp when event has occured.
public int
id
The id indicates the type of the event.
public int
x
The x coordinate of event.
public int
y
The y coordinate of event.
public int
key
The key code of key event.
public int
modifiers
The state of the modifier keys (given by a bitmask).
public int
clickCount
The click count indicates the number of consecutive clicks.
public Object
arg
The argument of the event.
public Event
evt
The next event.
Constructors Summary
public Event(Object target, int id, Object arg)
Instantiates a new event with the specified target component, event type, and argument.

param
target the target component.
param
id the event type.
param
arg the argument.


                                                                      
           
        this(target, 0l, id, 0, 0, 0, 0, arg);
    
public Event(Object target, long when, int id, int x, int y, int key, int modifiers)
Instantiates a new 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.

param
target the target component.
param
when the time stamp.
param
id the event type.
param
x the x coordinate.
param
y the y coordinate.
param
key the key.
param
modifiers the modifier keys state.

        this(target, when, id, x, y, key, modifiers, null);
    
public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)
Instantiates a new event with the specified target component, time stamp, event type, x and y coordinates, keyboard key, state of the modifier keys, and an argument.

param
target the target component.
param
when the time stamp.
param
id the event type.
param
x the x coordinate.
param
y the y coordinate.
param
key the key.
param
modifiers the modifier keys state.
param
arg the specified argument.

        this.target = target;
        this.when = when;
        this.id = id;
        this.x = x;
        this.y = y;
        this.key = key;
        this.modifiers = modifiers;
        this.arg = arg;
    
Methods Summary
public booleancontrolDown()
Checks if Control key is down or not.

return
true, if Control key is down; false otherwise.

        return (modifiers & CTRL_MASK) != 0;
    
private java.lang.StringgetModifiersString()
Gets a string representation of the modifiers.

return
a string representation of the modifiers.

        String strMod = ""; //$NON-NLS-1$
        if (shiftDown()) {
            strMod += ",shift"; //$NON-NLS-1$
        }
        if (controlDown()) {
            strMod += ",control"; //$NON-NLS-1$
        }
        if (metaDown()) {
            strMod += ",meta"; //$NON-NLS-1$
        }
        return strMod;
    
public booleanmetaDown()
Checks if Meta key is down or not.

return
true, if Meta key is down; false otherwise.

        return (modifiers & META_MASK) != 0;
    
protected java.lang.StringparamString()
Returns a string representing the state of this Event.

return
a string representing the state of this Event.

        return "id=" + id + ",x=" + x + ",y=" + y + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                (key != 0 ? ",key=" + key + getModifiersString() : "") + //$NON-NLS-1$ //$NON-NLS-2$
                ",target=" + target + //$NON-NLS-1$
                (arg != null ? ",arg=" + arg : ""); //$NON-NLS-1$ //$NON-NLS-2$
    
public booleanshiftDown()
Checks if Shift key is down or not.

return
true, if Shift key is down; false otherwise.

        return (modifiers & SHIFT_MASK) != 0;
    
public java.lang.StringtoString()
Returns a string representation of this Event.

return
a string representation of this Event.

        /*
         * The format is based on 1.5 release behavior which can be revealed by
         * the following code: Event e = new Event(new Button(), 0l,
         * Event.KEY_PRESS, 0, 0, Event.TAB, Event.SHIFT_MASK, "arg");
         * System.out.println(e);
         */

        return getClass().getName() + "[" + paramString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
    
public voidtranslate(int dx, int dy)
Translates x and y coordinates of his event to the x+dx and x+dy coordinates.

param
dx the distance by which the event's x coordinate is increased.
param
dy the distance by which the event's y coordinate is increased.

        x += dx;
        y += dy;