Class JaxoZoom

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, javax.swing.event.MouseInputListener

    public class JaxoZoom
    extends javax.swing.event.MouseInputAdapter
    A zoom on the canvas.
    Since:
    2.0
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getZoomFactor()
      Returns the zoom factor.
      static int getZoomFactorFor​(int mode)
      Returns the zoom factor size for the given mode.
      boolean isActive()
      Determines the state of this zoom.
      void mouseDragged​(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is dragged on the canvas.
      void mousePressed​(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is pressed on the canvas.
      void mouseReleased​(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is released on the canvas.
      void setActive​(boolean value)
      Activate/Deactivate this zoom.
      void setBackground​(java.awt.Image bg)
      Sets the background image for the zoom.
      void setZoomFactor​(int zf)
      Sets the zoom factor.
      void setZoomFactorFor​(int mode)
      Set the zoom size for a given mode.
      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
    • Constructor Detail

      • JaxoZoom

        public JaxoZoom​(JaxoCanvasComponent canvas)
        Constructor.
        Parameters:
        canvas - The JaxoCanvas to zoom on.
    • Method Detail

      • 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

        public void setBackground​(java.awt.Image bg)
        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 in JaxoConstants.
        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 in JaxoConstants.
      • mousePressed

        public final void mousePressed​(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is pressed on the canvas.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class java.awt.event.MouseAdapter
        Parameters:
        e - The corresponding mouse event.
      • mouseDragged

        public final void mouseDragged​(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is dragged on the canvas.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Overrides:
        mouseDragged in class java.awt.event.MouseAdapter
        Parameters:
        e - The corresponding mouse event.
      • mouseReleased

        public final void mouseReleased​(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is released on the canvas.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Overrides:
        mouseReleased in class java.awt.event.MouseAdapter
        Parameters:
        e - The corresponding mouse event.