Class MouseWheelHandler

  • All Implemented Interfaces:
    java.awt.event.MouseWheelListener, java.io.Serializable, java.util.EventListener

    public class MouseWheelHandler
    extends java.lang.Object
    implements java.awt.event.MouseWheelListener, java.io.Serializable
    A class that handles mouse wheel events for the ChartPanel class.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private ChartPanel chartPanel
      The chart panel.
      (package private) double zoomFactor
      The zoom factor.
    • Constructor Summary

      Constructors 
      Constructor Description
      MouseWheelHandler​(ChartPanel chartPanel)
      Creates a new instance for the specified chart panel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getZoomFactor()
      Returns the current zoom factor.
      private void handleZoomable​(Zoomable zoomable, java.awt.event.MouseWheelEvent e)
      Handle the case where a plot implements the Zoomable interface.
      void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
      Handles a mouse wheel event from the underlying chart panel.
      void setZoomFactor​(double zoomFactor)
      Sets the zoom factor.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • chartPanel

        private ChartPanel chartPanel
        The chart panel.
      • zoomFactor

        double zoomFactor
        The zoom factor.
    • Constructor Detail

      • MouseWheelHandler

        public MouseWheelHandler​(ChartPanel chartPanel)
        Creates a new instance for the specified chart panel.
        Parameters:
        chartPanel - the chart panel (null not permitted).
    • Method Detail

      • getZoomFactor

        public double getZoomFactor()
        Returns the current zoom factor. The default value is 0.10 (ten percent).
        Returns:
        The zoom factor.
        See Also:
        setZoomFactor(double)
      • setZoomFactor

        public void setZoomFactor​(double zoomFactor)
        Sets the zoom factor.
        Parameters:
        zoomFactor - the zoom factor.
        See Also:
        getZoomFactor()
      • mouseWheelMoved

        public void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
        Handles a mouse wheel event from the underlying chart panel.
        Specified by:
        mouseWheelMoved in interface java.awt.event.MouseWheelListener
        Parameters:
        e - the event.
      • handleZoomable

        private void handleZoomable​(Zoomable zoomable,
                                    java.awt.event.MouseWheelEvent e)
        Handle the case where a plot implements the Zoomable interface.
        Parameters:
        zoomable - the zoomable plot.
        e - the mouse wheel event.