source: trunk/src/gcc/libjava/java/awt/event/MouseEvent.java@ 154

Last change on this file since 154 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1/* Copyright (C) 2000, 2002 Free Software Foundation
2
3 This file is part of libjava.
4
5This software is copyrighted work licensed under the terms of the
6Libjava License. Please consult the file "LIBJAVA_LICENSE" for
7details. */
8
9package java.awt.event;
10import java.awt.*;
11
12/**
13 * @author Tom Tromey <[email protected]>
14 * @date April 8, 2000
15 */
16
17/* Status: Believed complete and correct to JDK 1.2. */
18
19public class MouseEvent extends InputEvent
20{
21 public static final int MOUSE_CLICKED = 500;
22 public static final int MOUSE_DRAGGED = 506;
23 public static final int MOUSE_ENTERED = 504;
24 public static final int MOUSE_EXITED = 505;
25 public static final int MOUSE_FIRST = 500;
26 public static final int MOUSE_LAST = 506;
27 public static final int MOUSE_MOVED = 503;
28 public static final int MOUSE_PRESSED = 501;
29 public static final int MOUSE_RELEASED = 502;
30
31 public MouseEvent (Component source, int id, long when, int modifiers,
32 int x, int y, int clickCount, boolean popupTrigger)
33 {
34 super (source, id);
35 this.when = when;
36 this.modifiers = modifiers;
37 this.x = x;
38 this.y = y;
39 this.clickCount = clickCount;
40 this.popupTrigger = popupTrigger;
41 }
42
43 public int getClickCount ()
44 {
45 return clickCount;
46 }
47
48 public Point getPoint ()
49 {
50 return new Point (x, y);
51 }
52
53 public int getX ()
54 {
55 return x;
56 }
57
58 public int getY ()
59 {
60 return y;
61 }
62
63 public boolean isPopupTrigger ()
64 {
65 return popupTrigger;
66 }
67
68 public String paramString ()
69 {
70 String r;
71 switch (id)
72 {
73 case MOUSE_CLICKED:
74 r = "MOUSE_CLICKED";
75 break;
76 case MOUSE_DRAGGED:
77 r = "MOUSE_DRAGGED";
78 break;
79 case MOUSE_ENTERED:
80 r = "MOUSE_ENTERED";
81 break;
82 case MOUSE_EXITED:
83 r = "MOUSE_EXITED";
84 break;
85 case MOUSE_MOVED:
86 r = "MOUSE_MOVED";
87 break;
88 case MOUSE_PRESSED:
89 r = "MOUSE_PRESSED";
90 break;
91 case MOUSE_RELEASED:
92 r = "MOUSE_RELEASED";
93 break;
94 default:
95 r = "unknown id";
96 break;
97 }
98 r += ",(" + x + "," + y + "),modifiers=" + modifiers + ",clickCount=" +
99 clickCount;
100 return r;
101 }
102
103 public void translatePoint (int x, int y)
104 {
105 this.x += x;
106 this.y += y;
107 }
108
109 private int x;
110 private int y;
111 private int clickCount;
112 private boolean popupTrigger;
113}
Note: See TracBrowser for help on using the repository browser.