Package net.sf.jaxodraw.gui
Class JaxoZoom
java.lang.Object
java.awt.event.MouseAdapter
javax.swing.event.MouseInputAdapter
net.sf.jaxodraw.gui.JaxoZoom
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
,MouseInputListener
A zoom on the canvas.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A zoom factor 2.static final int
A zoom factor 4.static final int
A zoom factor 8. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Returns the zoom factor.static final int
getZoomFactorFor
(int mode) Returns the zoom factor size for the given mode.final boolean
isActive()
Determines the state of this zoom.final void
The action to be taken when the mouse is dragged on the canvas.final void
The action to be taken when the mouse is pressed on the canvas.final void
The action to be taken when the mouse is released on the canvas.void
setActive
(boolean value) Activate/Deactivate this zoom.void
setBackground
(Image bg) Sets the background image for the zoom.final void
setZoomFactor
(int zf) Sets the zoom factor.void
setZoomFactorFor
(int mode) Set the zoom size for a given mode.final void
setZoomWindowSize
(int width, int height) Sets the size of the zoom window.Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited
Methods inherited from interface java.awt.event.MouseMotionListener
mouseMoved
-
Field Details
-
ZOOM_FACTOR_X2
public static final int ZOOM_FACTOR_X2A zoom factor 2.- See Also:
-
ZOOM_FACTOR_X4
public static final int ZOOM_FACTOR_X4A zoom factor 4.- See Also:
-
ZOOM_FACTOR_X8
public static final int ZOOM_FACTOR_X8A zoom factor 8.- See Also:
-
-
Constructor Details
-
JaxoZoom
Constructor.- Parameters:
canvas
- The JaxoCanvas to zoom on.
-
-
Method Details
-
isActive
public final boolean isActive()Determines the state of this zoom.- Returns:
- True if this zoom is currently activated.
-
setActive
public void setActive(boolean value) Activate/Deactivate this zoom.- Parameters:
value
- True to activate this zoom.
-
setZoomFactor
public final void setZoomFactor(int zf) Sets the zoom factor.- Parameters:
zf
- The zoom factor.
-
getZoomFactor
public final int getZoomFactor()Returns the zoom factor.- Returns:
- The zoom factor.
-
setZoomWindowSize
public final void setZoomWindowSize(int width, int height) Sets the size of the zoom window.- Parameters:
width
- The width of the zoom window.height
- The height of the zoom window.
-
setBackground
Sets the background image for the zoom.- Parameters:
bg
- The background image.
-
getZoomFactorFor
public static final int getZoomFactorFor(int mode) Returns the zoom factor size for the given mode.- Parameters:
mode
- A JaxoDraw mode as defined inJaxoConstants
.- Returns:
- The zoom factor size, or -1, if mode does not correspond to a zoom factor mode.
-
setZoomFactorFor
public void setZoomFactorFor(int mode) Set the zoom size for a given mode.- Parameters:
mode
- A JaxoDraw mode as defined inJaxoConstants
.
-
mousePressed
The action to be taken when the mouse is pressed on the canvas.- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classMouseAdapter
- Parameters:
e
- The corresponding mouse event.
-
mouseDragged
The action to be taken when the mouse is dragged on the canvas.- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classMouseAdapter
- Parameters:
e
- The corresponding mouse event.
-
mouseReleased
The action to be taken when the mouse is released on the canvas.- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classMouseAdapter
- Parameters:
e
- The corresponding mouse event.
-