aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/Event.java
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>2000-03-21 21:33:53 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2000-03-21 21:33:53 +0000
commit604de2bddf2b6feef052b4df6dfd1bde702a7ae6 (patch)
tree37fd34a6c7a30eac73ef27e24198674434e625d3 /libjava/java/awt/Event.java
parentec47ccca041a0d14973c5151914ce0930d55ff1c (diff)
downloadgcc-604de2bddf2b6feef052b4df6dfd1bde702a7ae6.zip
gcc-604de2bddf2b6feef052b4df6dfd1bde702a7ae6.tar.gz
gcc-604de2bddf2b6feef052b4df6dfd1bde702a7ae6.tar.bz2
Event.java: Add all the event type constants.
2000-03-21 Bryce McKinlay <bryce@albatross.co.nz> * java/awt/Event.java: Add all the event type constants. (Event): Implemented constructors. (controlDown): Implemented. (metaDown): Implemented. (paramString): Stubbed. (shiftDown): Implemented. (toString): Implemented. (translate): Implemented. From-SVN: r32676
Diffstat (limited to 'libjava/java/awt/Event.java')
-rw-r--r--libjava/java/awt/Event.java133
1 files changed, 131 insertions, 2 deletions
diff --git a/libjava/java/awt/Event.java b/libjava/java/awt/Event.java
index d72cc04..241e68e 100644
--- a/libjava/java/awt/Event.java
+++ b/libjava/java/awt/Event.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libjava.
@@ -8,14 +8,91 @@ details. */
package java.awt;
-/* A very incomplete placeholder. */
+/**
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct, except for the paramString()
+ * method, which is stubbed.
+ */
public class Event
{
+ public static final int SHIFT_MASK = 1,
+ CTRL_MASK = 2,
+ META_MASK = 4,
+ ALT_MASK = 8;
+
+ public static final int ACTION_EVENT = 1001,
+ BACK_SPACE = 8,
+ CAPS_LOCK = 1022,
+ DELETE = 127,
+ DOWN = 1005,
+ END = 1001,
+ ENTER = 10,
+ ESCAPE = 27,
+ F1 = 1008,
+ F10 = 1017,
+ F11 = 1018,
+ F12 = 1019,
+ F2 = 1009,
+ F3 = 1010,
+ F4 = 1011,
+ F5 = 1012,
+ F6 = 1013,
+ F7 = 1014,
+ F8 = 1015,
+ F9 = 1016,
+ GOT_FOCUS = 1004,
+ HOME = 1000,
+ INSERT = 1025,
+ KEY_ACTION = 403,
+ KEY_ACTION_RELEASE = 404,
+ KEY_PRESS = 401,
+ KEY_RELEASE = 402,
+ LEFT = 1006,
+ LIST_DESELECT = 702,
+ LIST_SELECT = 701,
+ LOAD_FILE = 1002,
+ LOST_FOCUS = 1005,
+ MOUSE_DOWN = 501,
+ MOUSE_DRAG = 506,
+ MOUSE_ENTER = 504,
+ MOUSE_EXIT = 505,
+ MOUSE_MOVE = 503,
+ MOUSE_UP = 502,
+ NUM_LOCK = 1023,
+ PAUSE = 1024,
+ PGDN = 1003,
+ PGUP = 1002,
+ PRINT_SCREEN = 1020,
+ RIGHT = 1007,
+ SAVE_FILE = 1003,
+ SCROLL_ABSOLUTE = 605,
+ SCROLL_BEGIN = 606,
+ SCROLL_END = 607,
+ SCROLL_LINE_DOWN = 602,
+ SCROLL_LINE_UP = 601,
+ SCROLL_LOCK = 1021,
+ SCROLL_PAGE_DOWN = 604,
+ SCROLL_PAGE_UP = 603,
+ TAB = 9,
+ UP = 1004,
+ WINDOW_DEICONIFY = 204,
+ WINDOW_DESTROY = 201,
+ WINDOW_EXPOSE = 202,
+ WINDOW_ICONIFY = 203,
+ WINDOW_MOVED = 205;
+
public Event evt;
public Object arg;
+ public int clickCount;
public int id;
+ public int key;
+ public int modifiers;
public Object target;
+ public long when;
+ public int x;
+ public int y;
public Event (Object target, int id, Object arg)
{
@@ -23,4 +100,56 @@ public class Event
this.target = target;
this.arg = arg;
}
+
+ public Event (Object target, long when, int id, int x, int y, int key,
+ int modifiers)
+ {
+ this.target = target;
+ this.when = when;
+ this.id = id;
+ this.x = x;
+ this.y = y;
+ this.key = key;
+ this.modifiers = modifiers;
+ }
+
+ public Event (Object target, long when, int id, int x, int y, int key,
+ int modifiers, Object arg)
+ {
+ this (target, when, id, x, y, key, modifiers);
+ this.arg = arg;
+ }
+
+ public boolean controlDown ()
+ {
+ return ((modifiers & CTRL_MASK) == 0 ? false : true);
+ }
+
+ public boolean metaDown ()
+ {
+ return ((modifiers & META_MASK) == 0 ? false : true);
+ }
+
+ protected String paramString ()
+ {
+ return "Event.paramString() not implemented";
+ }
+
+ public boolean shiftDown()
+ {
+ return ((modifiers & SHIFT_MASK) == 0 ? false : true);
+ }
+
+ public String toString()
+ {
+ String r = getClass() + "[id=" + id + ",x=" + x + ",y=" + y + "target="
+ + ((target == null) ? "null" : target) + "]";
+ return r;
+ }
+
+ public void translate (int x, int y)
+ {
+ this.x += x;
+ this.y += y;
+ }
}