Class JSVGScrollPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JSVGScrollPane extends JPanel
A Swing component that consists of a JSVGCanvas with optional scroll bars.

Reimplementation, rather than implementing the Scrollable interface, provides several advantages. The main advantage is the ability to control more precisely ScrollBar events; fewer JSVGCanvas updates are required when scrolling. This creates a significant performance (reflected by an increase in scroll speed) advantage compared to implementing the Scrollable interface.

Version:
$Id: JSVGScrollPane.java 1851346 2019-01-15 13:41:00Z ssteiner $
See Also:
  • Field Details

  • Constructor Details

    • JSVGScrollPane

      public JSVGScrollPane(JSVGCanvas canvas)
      Creates a JSVGScrollPane, which will scroll an JSVGCanvas.
  • Method Details

    • getScrollbarsAlwaysVisible

      public boolean getScrollbarsAlwaysVisible()
    • setScrollbarsAlwaysVisible

      public void setScrollbarsAlwaysVisible(boolean vis)
    • createScrollBarListener

      protected JSVGScrollPane.SBListener createScrollBarListener(boolean isVertical)
      Scrollbar listener factory method so subclasses can override the default SBListener behaviour.
    • createScrollListener

      protected JSVGScrollPane.ScrollListener createScrollListener()
      Factory method so subclasses can override the default listener behaviour
    • createLoadListener

      protected SVGDocumentLoaderListener createLoadListener()
      Factory method so subclasses can override the default load listener.
    • getCanvas

      public JSVGCanvas getCanvas()
    • reset

      public void reset()
      Resets this object (for reloads), releasing any cached data and recomputing scroll extents.
    • setScrollPosition

      protected void setScrollPosition()
      Sets the translation portion of the transform based upon the current scroll bar position
    • resizeScrollBars

      protected void resizeScrollBars()
      Compute the scrollbar extents, and determine if scrollbars should be visible.
    • updateScrollbarVisibility

      protected Dimension updateScrollbarVisibility(int tx, int ty, int maxW, int maxH)
    • updateScrollbarState

      protected void updateScrollbarState(boolean hNeeded, boolean vNeeded)
    • checkAndSetViewBoxRect

      protected void checkAndSetViewBoxRect()
      Derives the SVG Viewbox from the SVG root element. Caches it. Assumes that it will not change.
    • getViewBoxRect

      protected Rectangle2D getViewBoxRect()
    • scaleChange

      public void scaleChange(float scale)
      Called when the scale size changes. The scale factor (1.0 == original size). By default, this method does nothing, but may be overidden to display a scale (zoom) factor in a status bar, for example.