Class PanScrollZoomDemo

All Implemented Interfaces:
ActionListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants, ChartChangeListener

public class PanScrollZoomDemo
extends JFrame
implements ActionListener, ChangeListener, ChartChangeListener, MouseListener, MouseMotionListener
A demo for panning, scrolling and zooming.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • PanScrollZoomDemo

      public PanScrollZoomDemo​(String frameTitle)
      Creates a new demo instance.
      Parameters:
      frameTitle - the frame title.
  • Method Details

    • actionPerformed

      public void actionPerformed​(ActionEvent evt)
      Handles an action event.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      evt - the event.
    • stateChanged

      public void stateChanged​(ChangeEvent event)
      Handles a ChangeEvent (in this case, coming from the scrollbar).
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - the event.
    • chartChanged

      public void chartChanged​(ChartChangeEvent event)
      Handles a ChartChangeEvent.
      Specified by:
      chartChanged in interface ChartChangeListener
      Parameters:
      event - the event.
    • mousePressed

      public void mousePressed​(MouseEvent event)
      Handles a mouse pressed event (to start panning).
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      event - the event.
    • mouseReleased

      public void mouseReleased​(MouseEvent event)
      Handles a mouse released event (stops panning).
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      event - the event.
    • mouseDragged

      public void mouseDragged​(MouseEvent event)
      Handles a mouse dragged event to perform panning.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      event - the event.
    • mouseClicked

      public void mouseClicked​(MouseEvent event)
      Handles a mouse clicked event, in this case by ignoring it.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - the event.
    • mouseMoved

      public void mouseMoved​(MouseEvent event)
      Handles a mouse moved event, in this case by ignoring it.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      event - the event.
    • mouseEntered

      public void mouseEntered​(MouseEvent event)
      Handles a mouse entered event, in this case by ignoring it.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      event - the event.
    • mouseExited

      public void mouseExited​(MouseEvent event)
      Handles a mouse exited event, in this case by ignoring it.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      event - the event.
    • main

      public static void main​(String[] args)
      Starting point for the demo.
      Parameters:
      args - the command line arguments (ignored).