Class SimpleScrollPane

All Implemented Interfaces:
MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, ScrollPaneConstants

public class SimpleScrollPane extends JScrollPane implements ChangeListener, MouseWheelListener
SimpleScrollPane is a special scroll pane. There is no scroll bar. It just uses four scroll buttons to do the scrolling.
See Also:
  • Field Details

  • Constructor Details

    • SimpleScrollPane

      public SimpleScrollPane(Component view, int vsbPolicy, int hsbPolicy)
      Creates a JideScrollPane 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 VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy(int) and JScrollPane.setHorizontalScrollBarPolicy(int).
      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
      See Also:
    • SimpleScrollPane

      public SimpleScrollPane(Component view)
      Creates a JideScrollPane 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.
      Parameters:
      view - the component to display in the scrollpane's viewport
      See Also:
    • SimpleScrollPane

      public SimpleScrollPane(int vsbPolicy, int hsbPolicy)
      Creates an empty (no viewport view) JideScrollPane with specified scrollbar policies. The available policy settings are listed at JScrollPane.setVerticalScrollBarPolicy(int) and JScrollPane.setHorizontalScrollBarPolicy(int).
      Parameters:
      vsbPolicy - an integer that specifies the vertical scrollbar policy
      hsbPolicy - an integer that specifies the horizontal scrollbar policy
      See Also:
    • SimpleScrollPane

      public SimpleScrollPane()
      Creates an empty (no viewport view) JideScrollPane where both horizontal and vertical scrollbars appear when needed.
  • Method Details

    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JScrollPane
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener
    • getScrollUpButton

      public AbstractButton getScrollUpButton()
    • setScrollUpButton

      public void setScrollUpButton(AbstractButton scrollUpButton)
    • getScrollDownButton

      public AbstractButton getScrollDownButton()
    • setScrollDownButton

      public void setScrollDownButton(AbstractButton scrollDownButton)
    • getScrollLeftButton

      public AbstractButton getScrollLeftButton()
    • setScrollLeftButton

      public void setScrollLeftButton(AbstractButton scrollLeftButton)
    • getScrollRightButton

      public AbstractButton getScrollRightButton()
    • setScrollRightButton

      public void setScrollRightButton(AbstractButton scrollRightButton)
    • createScrollButton

      protected AbstractButton createScrollButton(int type)
      Creates the scroll button. You can override this method to change the attributes on the button. For example, you can do this to create a bigger scroll button.
       SimpleScrollPane pane = new SimpleScrollPane(){
           protected AbstractButton createScrollButton(int type) {
               AbstractButton scrollButton = super.createScrollButton(type);
               scrollButton.setPreferredSize(new Dimension(20, 20));
               return scrollButton;
           }
       };
       
      Parameters:
      type - the type of the scroll button. It could be SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.WEST or SwingConstants.EAST .
      Returns:
      the scroll button.
    • updateButtonState

      protected void updateButtonState()
    • scroll

      public void scroll(JViewport viewport, int type)
    • getViewportBorderBounds

      public Rectangle getViewportBorderBounds()
      Overrides:
      getViewportBorderBounds in class JScrollPane
    • getHorizontalUnitIncrement

      public int getHorizontalUnitIncrement()
    • setHorizontalUnitIncrement

      public void setHorizontalUnitIncrement(int horizontalUnitIncrement)
    • getVerticalUnitIncrement

      public int getVerticalUnitIncrement()
    • setVerticalUnitIncrement

      public void setVerticalUnitIncrement(int verticalUnitIncrement)
    • isScrollOnRollover

      public boolean isScrollOnRollover()
      Checks if the scroll button scrolls on rollover.
      Returns:
      true if it scrolls on rollover.
    • setScrollOnRollover

      public void setScrollOnRollover(boolean scrollOnRollover)
      Sets scroll on rollover. If true, the scrolling will start when mouse is placed above the scroll button. If false, the scrolling will start only when you click or press and hold the mouse button.
      Parameters:
      scrollOnRollover - true or false.
    • getRepeatDelay

      public int getRepeatDelay()
      Gets the delay in ms between each unit scrolling.
      Returns:
      the delay.
    • setRepeatDelay

      public void setRepeatDelay(int repeatDelay)
      Sets the delay in ms between each unit scrolling. By default, it's 50. The big thenumberr, the slow the scrolling.
      Parameters:
      repeatDelay - the new repeat delay.
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
    • setWheelScrollingEnabled

      public void setWheelScrollingEnabled(boolean handleWheel)
      Overrides:
      setWheelScrollingEnabled in class JScrollPane