1 18 package org.apache.batik.gvt.event; 19 20 import java.awt.Point ; 21 import java.awt.event.MouseEvent ; 22 import java.awt.geom.Point2D ; 23 24 import org.apache.batik.gvt.GraphicsNode; 25 26 33 public class GraphicsNodeMouseEvent extends GraphicsNodeInputEvent { 34 35 38 static final int MOUSE_FIRST = 500; 39 40 44 public static final int MOUSE_CLICKED = MOUSE_FIRST; 45 46 50 public static final int MOUSE_PRESSED = MOUSE_FIRST + 1; 51 52 56 public static final int MOUSE_RELEASED = MOUSE_FIRST + 2; 57 58 62 public static final int MOUSE_MOVED = MOUSE_FIRST + 3; 63 64 68 public static final int MOUSE_ENTERED = MOUSE_FIRST + 4; 69 70 74 public static final int MOUSE_EXITED = MOUSE_FIRST + 5; 75 76 81 public static final int MOUSE_DRAGGED = MOUSE_FIRST + 6; 82 83 87 float x; 88 89 93 float y; 94 95 int clientX; 96 97 int clientY; 98 99 int screenX; 100 101 int screenY; 102 103 106 int clickCount; 107 108 113 GraphicsNode relatedNode = null; 114 115 129 public GraphicsNodeMouseEvent(GraphicsNode source, int id, 130 long when, int modifiers, 131 float x, float y, 132 int clientX, int clientY, 133 int screenX, int screenY, 134 int clickCount, 135 GraphicsNode relatedNode) { 136 super(source, id, when, modifiers); 137 this.x = x; 138 this.y = y; 139 this.clientX = clientX; 140 this.clientY = clientY; 141 this.screenX = screenX; 142 this.screenY = screenY; 143 this.clickCount = clickCount; 144 this.relatedNode = relatedNode; 145 } 146 147 153 public GraphicsNodeMouseEvent(GraphicsNode source, MouseEvent evt) { 154 super(source, evt); 155 this.x = evt.getX(); 156 this.y = evt.getY(); 157 this.clickCount = evt.getClickCount(); 158 } 159 160 165 public float getX() { 166 return x; 167 } 168 169 173 public float getY() { 174 return y; 175 } 176 177 182 public float getClientX() { 183 return clientX; 184 } 185 186 190 public float getClientY() { 191 return clientY; 192 } 193 194 199 public int getScreenX() { 200 return screenX; 201 } 202 203 207 public int getScreenY() { 208 return screenY; 209 } 210 211 215 public Point getScreenPoint() { 216 return new Point (screenX, screenY); 217 } 218 219 223 public Point getClientPoint() { 224 return new Point (clientX, clientY); 225 } 226 227 231 public Point2D getPoint2D() { 232 return new Point2D.Float (x, y); 233 } 234 235 239 public int getClickCount() { 240 return clickCount; 241 } 242 243 250 public GraphicsNode getRelatedNode() { 251 return relatedNode; 252 } 253 } 254 | Popular Tags |