Class GraphZoomScrollPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GraphZoomScrollPane extends JPanel
GraphZoomScrollPane is a Container for the Graph's VisualizationViewer and includes custom horizontal and vertical scrollbars. GraphZoomScrollPane listens for changes in the scale and translation of the VisualizationViewer, and will update the scrollbar positions and sizes accordingly. Changes in the scrollbar positions will cause the corresponding change in the translation component (offset) of the VisualizationViewer. The scrollbars are modified so that they will allow panning of the graph when the scale has been changed (e.g. zoomed-in or zoomed-out). The lower-right corner of this component is available to use as a small button or menu. samples.graph.GraphZoomScrollPaneDemo shows the use of this component.
See Also:
  • Field Details

    • vv

      protected VisualizationViewer<?,?> vv
    • horizontalScrollBar

      protected JScrollBar horizontalScrollBar
    • verticalScrollBar

      protected JScrollBar verticalScrollBar
    • corner

      protected JComponent corner
    • scrollBarsMayControlAdjusting

      protected boolean scrollBarsMayControlAdjusting
    • south

      protected JPanel south
  • Constructor Details

    • GraphZoomScrollPane

      public GraphZoomScrollPane(VisualizationViewer<?,?> vv)
      Create an instance of the GraphZoomScrollPane to contain the VisualizationViewer
      Parameters:
      vv - the VisualizationViewer for which this instance is to be created
  • Method Details

    • setScrollBars

      private void setScrollBars(VisualizationViewer<?,?> vv)
      use the supplied vv characteristics to set the position and dimensions of the scroll bars. Called in response to a ChangeEvent from the VisualizationViewer
      Parameters:
      xform - the transform of the VisualizationViewer
    • setScrollBarValues

      protected void setScrollBarValues(Rectangle rectangle, Point2D h0, Point2D h1, Point2D v0, Point2D v1)
    • getCorner

      public JComponent getCorner()
      Returns:
      Returns the corner component.
    • setCorner

      public void setCorner(JComponent corner)
      Parameters:
      corner - The cornerButton to set.
    • getHorizontalScrollBar

      public JScrollBar getHorizontalScrollBar()
    • getVerticalScrollBar

      public JScrollBar getVerticalScrollBar()