Class JScrollIndicator

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JScrollIndicator extends JLayeredPane
A scrollpane like component, where the scroll bars are floating over the scrollable view to indicate the current scroll positions. The scroll indicators appear smoothly during scroll events and disappear smoothly afterward.

The scrollbars can be dragged just as normal.

The usage is similar to a classic scrollpane.

Author:
Jolly Littlebottom
See Also:
  • Constructor Details

    • JScrollIndicator

      public JScrollIndicator(JComponent view)
      Creates a JScrollIndicator that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view and scrolling in underway or the mouse is over the scrollbar position. see #setViewportView
      Parameters:
      view - the component to display in the scrollpane's viewport
    • JScrollIndicator

      public JScrollIndicator(JComponent view, int scrollPaneConstants)
    • JScrollIndicator

      public JScrollIndicator(JComponent view, int vsbPolicy, int hsbPolicy)
      Creates a JScrollIndicator that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if vsbPolicy is JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at {link #JScrollPane.setVerticalScrollBarPolicy} and {link #JScrollPane.setHorizontalScrollBarPolicy}.
      Parameters:
      view - the component to display in the scrollpanes viewport
      vsbPolicy - an integer that specifies the vertical scrollbar policy
      hsbPolicy - an integer that specifies the horizontal scrollbar policy
  • Method Details

    • getScrollPane

      public JScrollPane getScrollPane()
      Returns the scroll pane used by this scroll indicator. Use carefully (e.g. to set unit increments) because not all changes have an effect. You have to write listeners in these cases (e.g. for changing the scrollbar policy)
      Returns: