|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.EventObject
java.awt.AWTEvent
java.awt.event.ComponentEvent
java.awt.event.InputEvent
java.awt.event.MouseEvent
diva.canvas.event.LayerEvent
public class LayerEvent
The class representing mouse events in layers. This class extends the AWT MouseEvent class, but adds the notion of floating-point coordinates and a "layer source" and "figure source" as well as a component source. Any code that processes a LayerEvent should be sure to use the methods getLayerX, getLayerY, getLayerPoint, instead of the inherited methods getX, getY, getPoint. (Originally, this class was designed to inherit from the AWT InputEvent class, which would have avoided the awkwardness of having two sets of coordinates in the same event object. This wasn't possible because InputEvent has only one package-scope constructor, and hence cannot be subclassed outside the AWT package.)
Field Summary |
---|
Fields inherited from class java.awt.event.MouseEvent |
---|
BUTTON1, BUTTON2, BUTTON3, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_FIRST, MOUSE_LAST, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_WHEEL, NOBUTTON |
Fields inherited from class java.awt.event.InputEvent |
---|
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK |
Fields inherited from class java.awt.event.ComponentEvent |
---|
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN |
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
LayerEvent(MouseEvent e)
Create a new layer event from the given mouse event. |
|
LayerEvent(MouseEvent e,
int id)
Create a new layer event from the given mouse event, but give it a different ID. |
Method Summary | |
---|---|
void |
consume()
Consume this event. |
Figure |
getFigureSource()
Get the figure that the event occurred on. |
Point2D |
getLayerPoint()
Get the point where the event occured. |
CanvasLayer |
getLayerSource()
Get the layer that the event occurred on. |
double |
getLayerX()
Get the horizontal component of the point where the event occured. |
double |
getLayerY()
Get the vertical component of the point where the event occured. |
static String |
idToString(int id)
Print the string representation of an event ID |
void |
setFigureSource(Figure figureSource)
Set the figure that the event occurred on. |
void |
setLayerPoint(Point2D point)
Set the layer position of the event |
void |
setLayerSource(CanvasLayer layerSource)
Set the layer that the event occurred on. |
void |
setLayerX(double x)
Set the layer X position of the event |
void |
setLayerY(double y)
Set the layer Y position of the event |
String |
toString()
Print the string representation of this event |
static String |
toString(int flags)
Print the string representation of modifier flags |
void |
transform(AffineTransform at)
Transform the layer coordinates of the event with the given transform. |
Methods inherited from class java.awt.event.MouseEvent |
---|
getButton, getClickCount, getMouseModifiersText, getPoint, getX, getY, isPopupTrigger, paramString, translatePoint |
Methods inherited from class java.awt.event.InputEvent |
---|
getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown |
Methods inherited from class java.awt.event.ComponentEvent |
---|
getComponent |
Methods inherited from class java.awt.AWTEvent |
---|
getID, setSource |
Methods inherited from class java.util.EventObject |
---|
getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LayerEvent(MouseEvent e)
public LayerEvent(MouseEvent e, int id)
Method Detail |
---|
public void consume()
consume
in class InputEvent
public CanvasLayer getLayerSource()
public Figure getFigureSource()
public Point2D getLayerPoint()
public double getLayerX()
public double getLayerY()
public void setFigureSource(Figure figureSource)
public void setLayerSource(CanvasLayer layerSource)
public void setLayerPoint(Point2D point)
public void setLayerX(double x)
public void setLayerY(double y)
public String toString()
toString
in class AWTEvent
public static String toString(int flags)
public static String idToString(int id)
public void transform(AffineTransform at)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |