Package velox.gui

Class BookmapScrollPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants

public class BookmapScrollPane extends JScrollPane
This is an extension of standard JScrollPane which has the following enhancements:

  1. This version of JScrollPane respects setMaximumSize regardless of layout
  2. It handles vertical scrollbar appearance/disappearance correctly - by default, it will change horizontal size automatically
  3. If compressFromOutside is set it will compress preferred size of inner component from outside automatically (thus making it downsize instead of just staying partially invisible under the scroll panel)
  4. Scrolling speed logic is different and stays the same regardless of content
See Also:
  • Constructor Details

    • BookmapScrollPane

      public BookmapScrollPane()
    • BookmapScrollPane

      public BookmapScrollPane(JComponent view)
    • BookmapScrollPane

      public BookmapScrollPane(JComponent view, boolean shouldAddSpaceForScrollbar)
  • Method Details

    • setCompressFromOutside

      public void setCompressFromOutside(boolean compressFromOutside)
      This method sets the value of compressFromOutside flag (see class documentation for the explanation of this flag).
      Parameters:
      compressFromOutside - flag value
    • setPreventSpaceForScrollbarIfShorterThanMaximumHeight

      public void setPreventSpaceForScrollbarIfShorterThanMaximumHeight(boolean preventSpaceForScrollbarIfShorterThanMaximumHeight)
      When the BookmapScrollPane is used in a component that resizes itself in response to its children preferred size, we end up in a case when the scroll pane adds some space for the scrollbar, but later receives enough space to show all the contents without the scrollbar. But, there is an additional horizontal space added, which messes up the layout.
      This flag forbids adding the space for the scrollbar if the scrollpane getPreferredSize().height is less than or equal to its #getMaximumSize().height. By default, maximum size is the size which will show all the scroll pane in screen.
      Parameters:
      preventSpaceForScrollbarIfShorterThanMaximumHeight - flag value
    • preferredSize

      public Dimension preferredSize()
      Overrides:
      preferredSize in class Container
    • doLayout

      public void doLayout()
      Overrides:
      doLayout in class Container