|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectzoomTool
public class zoomTool
The zoomTool is used to control and adjust the canvas's zooming size. It records the current canvas's zooming size and adjusts the size by listening for a MouseEvent. The state of zoomTool depends on the current canvas's zooming size. It should work with all operating systems and hardware. There are no variances and no security constraints.
Field Summary | |
---|---|
(package private) java.awt.image.BufferedImage |
backupImage
Holds the current, backup, selected and pasted image. |
(package private) java.awt.image.BufferedImage |
curImage
Holds the current, backup, selected and pasted image. |
(package private) boolean |
dragged
Whether the user dragged or not. |
java.awt.Graphics2D |
g2D
Holds a Graphics2D. |
java.awt.BasicStroke |
selectStroke
Holds the stroke that is selected. |
(package private) double |
theZoom
The current zooming size of the canvas. |
(package private) int |
x
The x of a mouse click. |
(package private) int |
y
The y of a mouse click. |
Constructor Summary | |
---|---|
zoomTool()
Creates a zoomTool object and sets the zoom to 1. |
Method Summary | |
---|---|
void |
clickAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Adjusts the canvas's zooming size by listening for the MouseEvent. |
void |
dragAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to drag the mouse, but is unnecessary for zooming. |
int |
getZoom()
Returns the value of theZoom, the state recorded by zoomTool, as an int. |
void |
mouseReleaseAction(java.awt.event.MouseEvent mevt,
main_canvas theCanvas)
Allows the user to release the mouse, but is unnecessary for zooming. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
double theZoom
int x
int y
boolean dragged
java.awt.image.BufferedImage backupImage
java.awt.image.BufferedImage curImage
public java.awt.Graphics2D g2D
public java.awt.BasicStroke selectStroke
Constructor Detail |
---|
public zoomTool()
Method Detail |
---|
public void clickAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
clickAction
in interface ourTool
mevt
- the mouse event which will determine the zooming size.theCanvas
- the reference of main_canvas whose zooming size will be adjusted.public void dragAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
dragAction
in interface ourTool
mevt
- mouse event.theCanvas
- the reference of main_canvas.public void mouseReleaseAction(java.awt.event.MouseEvent mevt, main_canvas theCanvas)
mouseReleaseAction
in interface ourTool
mevt
- mouse eventtheCanvas
- the reference of main_canvaspublic int getZoom()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |