1 7 8 package java.awt.dnd; 9 10 import java.awt.Point ; 11 12 import java.util.EventObject ; 13 14 41 42 public class DragSourceEvent extends EventObject { 43 44 private static final long serialVersionUID = -763287114604032641L; 45 46 52 private final boolean locationSpecified; 53 54 61 private final int x; 62 63 70 private final int y; 71 72 85 86 public DragSourceEvent(DragSourceContext dsc) { 87 super(dsc); 88 locationSpecified = false; 89 this.x = 0; 90 this.y = 0; 91 } 92 93 106 public DragSourceEvent(DragSourceContext dsc, int x, int y) { 107 super(dsc); 108 locationSpecified = true; 109 this.x = x; 110 this.y = y; 111 } 112 113 119 120 public DragSourceContext getDragSourceContext() { 121 return (DragSourceContext )getSource(); 122 } 123 124 134 public Point getLocation() { 135 if (locationSpecified) { 136 return new Point (x, y); 137 } else { 138 return null; 139 } 140 } 141 142 151 public int getX() { 152 return x; 153 } 154 155 164 public int getY() { 165 return y; 166 } 167 } 168 169 | Popular Tags |