jdk/src/java.desktop/share/classes/java/awt/Event.java
author serb
Mon, 31 Aug 2015 16:56:09 +0300
changeset 32493 31bd2a308840
parent 25859 3317bb8137f4
child 35667 ed476aba94de
permissions -rw-r--r--
8076178: [macosx] Few open swing and awt reg-tests fail after their update to avoid SunToolkit.realSync Reviewed-by: azvegint, yan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21278
diff changeset
     2
 * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
    32
 * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <code>Event</code> is a platform-independent class that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * encapsulates events from the platform's Graphical User
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Interface in the Java&nbsp;1.0 event model. In Java&nbsp;1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * and later versions, the <code>Event</code> class is maintained
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
    39
 * only for backwards compatibility. The information in this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * class description is provided to assist programmers in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * converting Java&nbsp;1.0 programs to the new event model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * In the Java&nbsp;1.0 event model, an event contains an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * {@link Event#id} field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * that indicates what type of event it is and which other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <code>Event</code> variables are relevant for the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * For keyboard events, {@link Event#key}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * contains a value indicating which key was activated, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * {@link Event#modifiers} contains the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * modifiers for that event.  For the KEY_PRESS and KEY_RELEASE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * event ids, the value of <code>key</code> is the unicode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * character code for the key. For KEY_ACTION and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * KEY_ACTION_RELEASE, the value of <code>key</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * one of the defined action-key identifiers in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <code>Event</code> class (<code>PGUP</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <code>PGDN</code>, <code>F1</code>, <code>F2</code>, etc).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @author     Sami Shaio
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 23010
diff changeset
    60
 * @since      1.0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
public class Event implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private transient long data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /* Modifier constants */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * This flag indicates that the Shift key was down when the event
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * occurred.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public static final int SHIFT_MASK          = 1 << 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * This flag indicates that the Control key was down when the event
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * occurred.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static final int CTRL_MASK           = 1 << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * This flag indicates that the Meta key was down when the event
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * occurred. For mouse events, this flag indicates that the right
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * button was pressed or released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public static final int META_MASK           = 1 << 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * This flag indicates that the Alt key was down when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * the event occurred. For mouse events, this flag indicates that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * middle mouse button was pressed or released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public static final int ALT_MASK            = 1 << 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /* Action keys */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * The Home key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public static final int HOME                = 1000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * The End key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public static final int END                 = 1001;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * The Page Up key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public static final int PGUP                = 1002;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * The Page Down key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public static final int PGDN                = 1003;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * The Up Arrow key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public static final int UP                  = 1004;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * The Down Arrow key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    public static final int DOWN                = 1005;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * The Left Arrow key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public static final int LEFT                = 1006;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * The Right Arrow key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public static final int RIGHT               = 1007;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * The F1 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    public static final int F1                  = 1008;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * The F2 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public static final int F2                  = 1009;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * The F3 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    public static final int F3                  = 1010;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * The F4 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public static final int F4                  = 1011;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * The F5 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public static final int F5                  = 1012;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * The F6 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    public static final int F6                  = 1013;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * The F7 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public static final int F7                  = 1014;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * The F8 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public static final int F8                  = 1015;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * The F9 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public static final int F9                  = 1016;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * The F10 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    public static final int F10                 = 1017;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * The F11 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    public static final int F11                 = 1018;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * The F12 function key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public static final int F12                 = 1019;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * The Print Screen key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public static final int PRINT_SCREEN        = 1020;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * The Scroll Lock key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public static final int SCROLL_LOCK         = 1021;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * The Caps Lock key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public static final int CAPS_LOCK           = 1022;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * The Num Lock key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public static final int NUM_LOCK            = 1023;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * The Pause key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public static final int PAUSE               = 1024;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * The Insert key, a non-ASCII action key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public static final int INSERT              = 1025;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /* Non-action keys */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * The Enter key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public static final int ENTER               = '\n';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * The BackSpace key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    public static final int BACK_SPACE          = '\b';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * The Tab key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    public static final int TAB                 = '\t';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * The Escape key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    public static final int ESCAPE              = 27;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * The Delete key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    public static final int DELETE              = 127;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /* Base for all window events. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    private static final int WINDOW_EVENT       = 200;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * The user has asked the window manager to kill the window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public static final int WINDOW_DESTROY      = 1 + WINDOW_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * The user has asked the window manager to expose the window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public static final int WINDOW_EXPOSE       = 2 + WINDOW_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * The user has asked the window manager to iconify the window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    public static final int WINDOW_ICONIFY      = 3 + WINDOW_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * The user has asked the window manager to de-iconify the window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public static final int WINDOW_DEICONIFY    = 4 + WINDOW_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * The user has asked the window manager to move the window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public static final int WINDOW_MOVED        = 5 + WINDOW_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /* Base for all keyboard events. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    private static final int KEY_EVENT          = 400;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * The user has pressed a normal key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public static final int KEY_PRESS           = 1 + KEY_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * The user has released a normal key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    public static final int KEY_RELEASE         = 2 + KEY_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * The user has pressed a non-ASCII <em>action</em> key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * The <code>key</code> field contains a value that indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * that the event occurred on one of the action keys, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * comprise the 12 function keys, the arrow (cursor) keys,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * Caps Lock, Num Lock, Pause, and Insert.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    public static final int KEY_ACTION          = 3 + KEY_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * The user has released a non-ASCII <em>action</em> key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * The <code>key</code> field contains a value that indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * that the event occurred on one of the action keys, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * comprise the 12 function keys, the arrow (cursor) keys,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * Caps Lock, Num Lock, Pause, and Insert.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public static final int KEY_ACTION_RELEASE  = 4 + KEY_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    /* Base for all mouse events. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    private static final int MOUSE_EVENT        = 500;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * The user has pressed the mouse button. The <code>ALT_MASK</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * flag indicates that the middle button has been pressed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * The <code>META_MASK</code>flag indicates that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * right button has been pressed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @see     java.awt.Event#ALT_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @see     java.awt.Event#META_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    public static final int MOUSE_DOWN          = 1 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * The user has released the mouse button. The <code>ALT_MASK</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * flag indicates that the middle button has been released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * The <code>META_MASK</code>flag indicates that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * right button has been released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @see     java.awt.Event#ALT_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @see     java.awt.Event#META_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public static final int MOUSE_UP            = 2 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * The mouse has moved with no button pressed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    public static final int MOUSE_MOVE          = 3 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * The mouse has entered a component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    public static final int MOUSE_ENTER         = 4 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * The mouse has exited a component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    public static final int MOUSE_EXIT          = 5 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * The user has moved the mouse with a button pressed. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * <code>ALT_MASK</code> flag indicates that the middle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * button is being pressed. The <code>META_MASK</code> flag indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * that the right button is being pressed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @see     java.awt.Event#ALT_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @see     java.awt.Event#META_MASK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    public static final int MOUSE_DRAG          = 6 + MOUSE_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    /* Scrolling events */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    private static final int SCROLL_EVENT       = 600;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * The user has activated the <em>line up</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * area of a scroll bar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    public static final int SCROLL_LINE_UP      = 1 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * The user has activated the <em>line down</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * area of a scroll bar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    public static final int SCROLL_LINE_DOWN    = 2 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * The user has activated the <em>page up</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * area of a scroll bar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    public static final int SCROLL_PAGE_UP      = 3 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * The user has activated the <em>page down</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * area of a scroll bar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public static final int SCROLL_PAGE_DOWN    = 4 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * The user has moved the bubble (thumb) in a scroll bar,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * moving to an "absolute" position, rather than to
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   393
     * an offset from the last position.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    public static final int SCROLL_ABSOLUTE     = 5 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * The scroll begin event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    public static final int SCROLL_BEGIN        = 6 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * The scroll end event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    public static final int SCROLL_END          = 7 + SCROLL_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    /* List Events */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    private static final int LIST_EVENT         = 700;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * An item in a list has been selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    public static final int LIST_SELECT         = 1 + LIST_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * An item in a list has been deselected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    public static final int LIST_DESELECT       = 2 + LIST_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    /* Misc Event */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    private static final int MISC_EVENT         = 1000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * This event indicates that the user wants some action to occur.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    public static final int ACTION_EVENT        = 1 + MISC_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * A file loading event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    public static final int LOAD_FILE           = 2 + MISC_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * A file saving event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    public static final int SAVE_FILE           = 3 + MISC_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * A component gained the focus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    public static final int GOT_FOCUS           = 4 + MISC_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * A component lost the focus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    public static final int LOST_FOCUS          = 5 + MISC_EVENT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * The target component. This indicates the component over which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * event occurred or with which the event is associated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * This object has been replaced by AWTEvent.getSource()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * @see java.awt.AWTEvent#getSource()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    public Object target;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * The time stamp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * Replaced by InputEvent.getWhen().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @see java.awt.event.InputEvent#getWhen()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    public long when;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * Indicates which type of event the event is, and which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * other <code>Event</code> variables are relevant for the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * This has been replaced by AWTEvent.getID()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * @see java.awt.AWTEvent#getID()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    public int id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * The <i>x</i> coordinate of the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * Replaced by MouseEvent.getX()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * @see java.awt.event.MouseEvent#getX()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    public int x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * The <i>y</i> coordinate of the event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * Replaced by MouseEvent.getY()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * @see java.awt.event.MouseEvent#getY()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    public int y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * The key code of the key that was pressed in a keyboard event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * This has been replaced by KeyEvent.getKeyCode()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @see java.awt.event.KeyEvent#getKeyCode()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    public int key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * The key character that was pressed in a keyboard event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
//    public char keyChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * The state of the modifier keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * This is replaced with InputEvent.getModifiers()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * In java 1.1 MouseEvent and KeyEvent are subclasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * of InputEvent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @see java.awt.event.InputEvent#getModifiers()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    public int modifiers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * For <code>MOUSE_DOWN</code> events, this field indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * number of consecutive clicks. For other events, its value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * <code>0</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * This field has been replaced by MouseEvent.getClickCount().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * @serial
20172
f48935a247ec 8025218: [javadoc] some errors in java/awt classes
yan
parents: 5506
diff changeset
   527
     * @see java.awt.event.MouseEvent#getClickCount()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    public int clickCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * An arbitrary argument of the event. The value of this field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * depends on the type of event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * <code>arg</code> has been replaced by event specific property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    public Object arg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * The next event. This field is set when putting events into a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * linked list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * This has been replaced by EventQueue.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * @see java.awt.EventQueue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    public Event evt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
    /* table for mapping old Event action keys to KeyEvent virtual keys. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    private static final int actionKeyCodes[][] = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    /*    virtual key              action key   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        { KeyEvent.VK_HOME,        Event.HOME         },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        { KeyEvent.VK_END,         Event.END          },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        { KeyEvent.VK_PAGE_UP,     Event.PGUP         },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
        { KeyEvent.VK_PAGE_DOWN,   Event.PGDN         },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        { KeyEvent.VK_UP,          Event.UP           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        { KeyEvent.VK_DOWN,        Event.DOWN         },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        { KeyEvent.VK_LEFT,        Event.LEFT         },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        { KeyEvent.VK_RIGHT,       Event.RIGHT        },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        { KeyEvent.VK_F1,          Event.F1           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        { KeyEvent.VK_F2,          Event.F2           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        { KeyEvent.VK_F3,          Event.F3           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
        { KeyEvent.VK_F4,          Event.F4           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        { KeyEvent.VK_F5,          Event.F5           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        { KeyEvent.VK_F6,          Event.F6           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
        { KeyEvent.VK_F7,          Event.F7           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        { KeyEvent.VK_F8,          Event.F8           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        { KeyEvent.VK_F9,          Event.F9           },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
        { KeyEvent.VK_F10,         Event.F10          },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
        { KeyEvent.VK_F11,         Event.F11          },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
        { KeyEvent.VK_F12,         Event.F12          },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        { KeyEvent.VK_PRINTSCREEN, Event.PRINT_SCREEN },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        { KeyEvent.VK_SCROLL_LOCK, Event.SCROLL_LOCK  },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        { KeyEvent.VK_CAPS_LOCK,   Event.CAPS_LOCK    },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        { KeyEvent.VK_NUM_LOCK,    Event.NUM_LOCK     },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        { KeyEvent.VK_PAUSE,       Event.PAUSE        },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        { KeyEvent.VK_INSERT,      Event.INSERT       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * This field controls whether or not the event is sent back
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * down to the peer once the target has processed it -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * false means it's sent to the peer, true means it's not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @see #isConsumed()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    private boolean consumed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * JDK 1.1 serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    private static final long serialVersionUID = 5488922509400504703L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        /* ensure that the necessary native libraries are loaded */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        Toolkit.loadLibraries();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
        if (!GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            initIDs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * Initialize JNI field and method IDs for fields that may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
       accessed from C.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    private static native void initIDs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   612
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * Creates an instance of <code>Event</code> with the specified target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * component, time stamp, event type, <i>x</i> and <i>y</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * coordinates, keyboard key, state of the modifier keys, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * @param     target     the target component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @param     when       the time stamp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * @param     id         the event type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * @param     x          the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * @param     y          the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * @param     key        the key pressed in a keyboard event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * @param     modifiers  the state of the modifier keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * @param     arg        the specified argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    public Event(Object target, long when, int id, int x, int y, int key,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
                 int modifiers, Object arg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        this.target = target;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        this.when = when;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        this.id = id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        this.x = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        this.y = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        this.key = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        this.modifiers = modifiers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        this.arg = arg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        this.data = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
        this.clickCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        switch(id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
          case ACTION_EVENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
          case WINDOW_DESTROY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
          case WINDOW_ICONIFY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
          case WINDOW_DEICONIFY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
          case WINDOW_MOVED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
          case SCROLL_LINE_UP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
          case SCROLL_LINE_DOWN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
          case SCROLL_PAGE_UP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
          case SCROLL_PAGE_DOWN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
          case SCROLL_ABSOLUTE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
          case SCROLL_BEGIN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
          case SCROLL_END:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
          case LIST_SELECT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
          case LIST_DESELECT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            consumed = true; // these types are not passed back to peer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   663
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * Creates an instance of <code>Event</code>, with the specified target
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * component, time stamp, event type, <i>x</i> and <i>y</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * coordinates, keyboard key, state of the modifier keys, and an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * argument set to <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * @param     target     the target component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * @param     when       the time stamp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * @param     id         the event type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * @param     x          the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * @param     y          the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * @param     key        the key pressed in a keyboard event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * @param     modifiers  the state of the modifier keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
    public Event(Object target, long when, int id, int x, int y, int key, int modifiers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
        this(target, when, id, x, y, key, modifiers, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   684
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * Creates an instance of <code>Event</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * target component, event type, and argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * @param     target     the target component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     * @param     id         the event type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * @param     arg        the specified argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
    public Event(Object target, int id, Object arg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        this(target, 0, id, 0, 0, 0, 0, arg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   699
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     * Translates this event so that its <i>x</i> and <i>y</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * coordinates are increased by <i>dx</i> and <i>dy</i>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * respectively.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * This method translates an event relative to the given component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * This involves, at a minimum, translating the coordinates into the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * local coordinate system of the given component. It may also involve
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * translating a region in the case of an expose event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * @param     dx     the distance to translate the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * @param     dy     the distance to translate the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
    public void translate(int dx, int dy) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        this.x += dx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
        this.y += dy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   720
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * Checks if the Shift key is down.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * @return    <code>true</code> if the key is down;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     *            <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * @see       java.awt.Event#modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @see       java.awt.Event#controlDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * @see       java.awt.Event#metaDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    public boolean shiftDown() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
        return (modifiers & SHIFT_MASK) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   736
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * Checks if the Control key is down.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * @return    <code>true</code> if the key is down;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     *            <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * @see       java.awt.Event#modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * @see       java.awt.Event#shiftDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * @see       java.awt.Event#metaDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    public boolean controlDown() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
        return (modifiers & CTRL_MASK) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   752
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * Checks if the Meta key is down.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * @return    <code>true</code> if the key is down;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     *            <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * @see       java.awt.Event#modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * @see       java.awt.Event#shiftDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * @see       java.awt.Event#controlDown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    public boolean metaDown() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
        return (modifiers & META_MASK) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   769
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    void consume() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        switch(id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
          case KEY_PRESS:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
          case KEY_RELEASE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
          case KEY_ACTION:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
          case KEY_ACTION_RELEASE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
              consumed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
              break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
              // event type cannot be consumed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   787
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    boolean isConsumed() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
        return consumed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   796
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     * Returns the integer key-code associated with the key in this event,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * as described in java.awt.Event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    static int getOldEventKey(KeyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        int keyCode = e.getKeyCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
        for (int i = 0; i < actionKeyCodes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
            if (actionKeyCodes[i][0] == keyCode) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                return actionKeyCodes[i][1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        return (int)e.getKeyChar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   814
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * Returns a new KeyEvent char which corresponds to the int key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * of this old event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
    char getKeyEventChar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
       for (int i = 0; i < actionKeyCodes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
            if (actionKeyCodes[i][1] == key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
                return KeyEvent.CHAR_UNDEFINED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
       return (char)key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   831
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * Returns a string representing the state of this <code>Event</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * This method is intended to be used only for debugging purposes, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * content and format of the returned string may vary between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * implementations. The returned string may be empty but may not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * @return    the parameter string of this event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
    protected String paramString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
        String str = "id=" + id + ",x=" + x + ",y=" + y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
        if (key != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            str += ",key=" + key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
        if (shiftDown()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
            str += ",shift";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
        if (controlDown()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
            str += ",control";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
        if (metaDown()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
            str += ",meta";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
        if (target != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
            str += ",target=" + target;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
        if (arg != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
            str += ",arg=" + arg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
        return str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20172
diff changeset
   867
     * available only for backwards compatibility.  It has been replaced
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * by the <code>AWTEvent</code> class and its subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * Returns a representation of this event's values as a string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * @return    a string that represents the event and the values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     *                 of its member fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * @see       java.awt.Event#paramString
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 23010
diff changeset
   874
     * @since     1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
        return getClass().getName() + "[" + paramString() + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
}