public class JComponentDragHandler
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
| Modifier and Type | Field and Description |
|---|---|
int |
dragDX |
int |
dragDY |
int |
mCurrentX |
int |
mCurrentY |
int |
mPressedX
These data members save the point at which the mouse was pressed
relative to the (0,0) corner of the JComponent.
|
int |
mPressedY |
java.awt.Point |
myLoc
Stores location data (typically of this JComponent)
as a Point for easy manipulation and to avoid re-creating a new object every time
these manipulations are done.
|
int |
oldLocX |
int |
oldLocY |
| Constructor and Description |
|---|
JComponentDragHandler(Workspace workspace,
javax.swing.JComponent jc)
Creates a new instance of a JComponentDragHandler with a pointer to the
given JComponent.
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.Cursor |
getDraggingCursor()
Returns the Cursor instance that is used on mouse drags
|
java.awt.Cursor |
getDragHintCursor()
Returns the Cursor instance that is used when a mouse is over a draggable object
|
java.awt.Point |
getMousePoint() |
void |
mouseClicked(java.awt.event.MouseEvent arg0) |
void |
mouseDragged(java.awt.event.MouseEvent e)
This method is called when the mouse is dragged over the JComponent.
|
void |
mouseEntered(java.awt.event.MouseEvent arg0) |
void |
mouseExited(java.awt.event.MouseEvent arg0) |
void |
mouseMoved(java.awt.event.MouseEvent e)
update the current location of the mouse
|
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the mouse is pressed over the JComponent.
|
void |
mouseReleased(java.awt.event.MouseEvent e) |
public int mPressedX
public int mPressedY
public int mCurrentX
public int mCurrentY
public int dragDX
public int dragDY
public int oldLocX
public int oldLocY
public java.awt.Point myLoc
public JComponentDragHandler(Workspace workspace, javax.swing.JComponent jc)
workspace - The workspace in usejc - the JComponent whose mouse events will be handled by this JComponentDragHandlerpublic java.awt.Cursor getDragHintCursor()
public java.awt.Cursor getDraggingCursor()
public java.awt.Point getMousePoint()
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent arg0)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent arg0)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent arg0)
mouseExited in interface java.awt.event.MouseListener