jj2000.disp
Class ImgMouseListener
java.lang.Object
|
+--java.awt.event.MouseAdapter
|
+--jj2000.disp.ImgMouseListener
- public class ImgMouseListener
- extends java.awt.event.MouseAdapter
- implements java.awt.event.MouseMotionListener
This class handles the dragging of an image displayed in an
ImgScrollPane. When the mouse is dragged the image scrolls accordingly.
Objects of this class must be registerd as both mouse listener and mouse
motion listener.
While the dragging is taking place the cursor is changed to the
MOVE_CURSOR type. The original cursor is restored when the mouse is
released after the drag.
Field Summary |
(package private) ImgScrollPane |
isp
The component where the image is displayed |
(package private) java.awt.Cursor |
prevCursor
|
(package private) int |
startMouseX
The horizontal coordinate where the drag starts |
(package private) int |
startMouseY
The vertical coordinate where the drag starts |
(package private) int |
startScrollX
The horizontal scroll position when the drag started |
(package private) int |
startScrollY
The vertical scroll position when the drag started |
Methods inherited from class java.awt.event.MouseAdapter |
mouseClicked,
mouseEntered,
mouseExited |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
isp
ImgScrollPane isp
- The component where the image is displayed
startMouseX
int startMouseX
- The horizontal coordinate where the drag starts
startMouseY
int startMouseY
- The vertical coordinate where the drag starts
startScrollX
int startScrollX
- The horizontal scroll position when the drag started
startScrollY
int startScrollY
- The vertical scroll position when the drag started
prevCursor
java.awt.Cursor prevCursor
ImgMouseListener
public ImgMouseListener(ImgScrollPane isp)
- Instantiate a new ImgMouseListener that will work on the specified
ImgScrollPane.
- Parameters:
isp
- The image scroll pane on which the actions should operate.
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Overrides:
- mousePressed in class java.awt.event.MouseAdapter
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Overrides:
- mouseReleased in class java.awt.event.MouseAdapter
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent evt)
- Specified by:
- mouseDragged in interface java.awt.event.MouseMotionListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent evt)
- Specified by:
- mouseMoved in interface java.awt.event.MouseMotionListener