Package org.pushingpixels.substance.internal.ui

# Class SubstanceScrollBarUI

java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ScrollBarUI
javax.swing.plaf.basic.BasicScrollBarUI
org.pushingpixels.substance.internal.ui.SubstanceScrollBarUI

All Implemented Interfaces:
  `LayoutManager`, `SwingConstants`, `TransitionAwareUI`

public class SubstanceScrollBarUI extends BasicScrollBarUI implements TransitionAwareUI
UI for scroll bars in Substance look and feel.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`SubstanceScrollBarUI.SubstanceArrowButtonListener`
Listener on arrow buttons.
`protected class`
`SubstanceScrollBarUI.SubstanceTrackListener`
Track mouse drags.

## Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicScrollBarUI

`BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected org.pushingpixels.substance.internal.ui.SubstanceScrollBarUI.CompositeButtonModel`
`compositeScrollTrackModel`
Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.
`protected StateTransitionTracker`
`compositeStateTransitionTracker`
`protected JButton`
`mySecondDecreaseButton`
The second decrease button.
`protected JButton`
`mySecondIncreaseButton`
The second increase button.
`protected int`
`scrollBarWidth`
Scroll bar width.
`protected AdjustmentListener`
`substanceAdjustmentListener`
Listener on adjustments made to the scrollbar model - this is for repaiting both scrollbars with the viewport.

### Fields inherited from class javax.swing.plaf.basic.BasicScrollBarUI

`buttonListener, decrButton, DECREASE_HIGHLIGHT, decrGap, incrButton, INCREASE_HIGHLIGHT, incrGap, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollListener, scrollTimer, thumbColor, thumbDarkShadowColor, thumbHighlightColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect`

### Fields inherited from interface javax.swing.SwingConstants

`BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`SubstanceScrollBarUI(JComponent b)`
Simple constructor.

## Method Summary

Modifier and Type
Method
Description
`protected BasicScrollBarUI.ArrowButtonListener`
`createArrowButtonListener()`
`protected JButton`
`createDecreaseButton(int orientation)`
`protected JButton`
`createGeneralDecreaseButton(int orientation, boolean isRegular)`
Creates a decrease button.
`protected JButton`
`createGeneralIncreaseButton(int orientation, boolean isRegular)`
Creates a increase button.
`protected JButton`
`createIncreaseButton(int orientation)`
`protected BasicScrollBarUI.TrackListener`
`createTrackListener()`
`static ComponentUI`
`createUI(JComponent comp)`
`static String`
`getMemoryUsage()`
Returns the memory usage string.
`Dimension`
`getPreferredSize(JComponent c)`
`protected ComponentState`
`getState(JButton scrollButton)`
Returns the scroll button state.
`StateTransitionTracker`
`getTransitionTracker()`
Returns the model for tracking the transitions.
`protected void`
`installComponents()`
`protected void`
`installDefaults()`
`protected void`
`installListeners()`
`boolean`
`isInside(MouseEvent me)`
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.
`protected void`
`layoutHScrollbar(JScrollBar sb)`
`protected void`
`layoutHScrollbarAdjacent(JScrollBar sb)`
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.
`protected void`
`layoutHScrollbarMultiple(JScrollBar sb)`
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.
`protected void`
`layoutHScrollbarMultipleBoth(JScrollBar sb)`
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.
`protected void`
`layoutHScrollbarNone(JScrollBar sb)`
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.NONE`.
`protected void`
`layoutVScrollbar(JScrollBar sb)`
`protected void`
`layoutVScrollbarAdjacent(JScrollBar sb)`
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.
`protected void`
`layoutVScrollbarMultiple(JScrollBar sb)`
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.
`protected void`
`layoutVScrollbarMultipleBoth(JScrollBar sb)`
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH`.
`protected void`
`layoutVScrollbarNone(JScrollBar sb)`
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.
`void`
`paint(Graphics g, JComponent c)`
`protected void`
`paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)`
`protected void`
`paintTrack(Graphics g, JComponent c, Rectangle trackBounds)`
`void`
`scrollByBlock(int direction)`
`void`
`scrollByUnits(int direction, int units)`
Scrolls the associated scroll bar.
`protected void`
`uninstallComponents()`
`protected void`
`uninstallListeners()`

### Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI

`addLayoutComponent, configureScrollBarColors, createModelListener, createPropertyChangeListener, createScrollListener, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installKeyboardActions, installUI, isThumbRollover, layoutContainer, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, preferredLayoutSize, removeLayoutComponent, scrollByUnit, setThumbBounds, setThumbRollover, uninstallDefaults, uninstallKeyboardActions, uninstallUI`

### Methods inherited from class javax.swing.plaf.ComponentUI

`contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, update`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### mySecondDecreaseButton

protected JButton mySecondDecreaseButton
The second decrease button. Is shown under `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`, `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE` and `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH` modes.

Since:
  version 3.1

### mySecondIncreaseButton

protected JButton mySecondIncreaseButton
The second increase button. Is shown only under `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH` mode.

Since:
  version 3.1

### compositeStateTransitionTracker

protected StateTransitionTracker compositeStateTransitionTracker

### scrollBarWidth

protected int scrollBarWidth
Scroll bar width.

### substanceAdjustmentListener

protected AdjustmentListener substanceAdjustmentListener
Listener on adjustments made to the scrollbar model - this is for repaiting both scrollbars with the viewport.

Since:
  version 3.2

### compositeScrollTrackModel

protected org.pushingpixels.substance.internal.ui.SubstanceScrollBarUI.CompositeButtonModel compositeScrollTrackModel
Surrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.

Since:
  version 3.2

## Constructor Details

### SubstanceScrollBarUI

protected SubstanceScrollBarUI(JComponent b)
Simple constructor.

Parameters:
  `b` - Associated component.

## Method Details

### createUI

public static ComponentUI createUI(JComponent comp)

### createGeneralDecreaseButton

protected JButton createGeneralDecreaseButton(int orientation, boolean isRegular)
Creates a decrease button.

Parameters:
  `orientation` - Button orientation.
  `isRegular` - if `true`, the regular (upper / left) decrease button is created, if `false`, the additional (lower / right) decrease button is created for `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT` , `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE` and `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH` kinds.
Returns:
  Decrease button.

### createDecreaseButton

protected JButton createDecreaseButton(int orientation)

Overrides:
  `createDecreaseButton` in class `BasicScrollBarUI`

### createIncreaseButton

protected JButton createIncreaseButton(int orientation)

Overrides:
  `createIncreaseButton` in class `BasicScrollBarUI`

### createGeneralIncreaseButton

protected JButton createGeneralIncreaseButton(int orientation, boolean isRegular)
Creates a increase button.

Parameters:
  `orientation` - Button orientation.
  `isRegular` - if `true`, the regular (lower / right) increase button is created, if `false`, the additional (upper / left) increase button is created for `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH` kind.
Returns:
  Increase button.

### getState

protected ComponentState getState(JButton scrollButton)
Returns the scroll button state.

Parameters:
  `scrollButton` - Scroll button.
Returns:
  Scroll button state.

### paintTrack

protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)

Overrides:
  `paintTrack` in class `BasicScrollBarUI`

### paintThumb

protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)

Overrides:
  `paintThumb` in class `BasicScrollBarUI`

### paint

public void paint(Graphics g, JComponent c)

Overrides:
  `paint` in class `BasicScrollBarUI`

### installDefaults

protected void installDefaults()

Overrides:
  `installDefaults` in class `BasicScrollBarUI`

### installComponents

protected void installComponents()

Overrides:
  `installComponents` in class `BasicScrollBarUI`

### uninstallComponents

protected void uninstallComponents()

Overrides:
  `uninstallComponents` in class `BasicScrollBarUI`

### installListeners

protected void installListeners()

Overrides:
  `installListeners` in class `BasicScrollBarUI`

### uninstallListeners

protected void uninstallListeners()

Overrides:
  `uninstallListeners` in class `BasicScrollBarUI`

### isInside

public boolean isInside(MouseEvent me)
Description copied from interface: `TransitionAwareUI`
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.

Specified by:
  `isInside` in interface `TransitionAwareUI`
Parameters:
  `me` - Mouse event.
Returns:
  `true` if the mouse position of the specified event lies inside the area of the component designated for transition effects, `false` otherwise.

### getTransitionTracker

public StateTransitionTracker getTransitionTracker()
Description copied from interface: `TransitionAwareUI`
Returns the model for tracking the transitions.

Specified by:
  `getTransitionTracker` in interface `TransitionAwareUI`
Returns:
  Model for tracking the transitions.

### scrollByBlock

public void scrollByBlock(int direction)

Overrides:
  `scrollByBlock` in class `BasicScrollBarUI`

### scrollByUnits

public void scrollByUnits(int direction, int units)
Scrolls the associated scroll bar.

Parameters:
  `direction` - Direction.
  `units` - Scroll units.

### layoutVScrollbar

protected void layoutVScrollbar(JScrollBar sb)

Overrides:
  `layoutVScrollbar` in class `BasicScrollBarUI`

### layoutHScrollbar

protected void layoutHScrollbar(JScrollBar sb)

Overrides:
  `layoutHScrollbar` in class `BasicScrollBarUI`

### layoutVScrollbarAdjacent

protected void layoutVScrollbarAdjacent(JScrollBar sb)
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.

Parameters:
  `sb` - Scroll bar.

### layoutVScrollbarNone

protected void layoutVScrollbarNone(JScrollBar sb)
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.

Parameters:
  `sb` - Scroll bar.

### layoutVScrollbarMultiple

protected void layoutVScrollbarMultiple(JScrollBar sb)
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.

Parameters:
  `sb` - Scroll bar.

### layoutVScrollbarMultipleBoth

protected void layoutVScrollbarMultipleBoth(JScrollBar sb)
Lays out the vertical scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH`.

Parameters:
  `sb` - Scroll bar.

### layoutHScrollbarAdjacent

protected void layoutHScrollbarAdjacent(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT`.

Parameters:
  `sb` - Scroll bar.

### layoutHScrollbarNone

protected void layoutHScrollbarNone(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.NONE`.

Parameters:
  `sb` - Scroll bar.

### layoutHScrollbarMultiple

protected void layoutHScrollbarMultiple(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.

Parameters:
  `sb` - Scroll bar.

### layoutHScrollbarMultipleBoth

protected void layoutHScrollbarMultipleBoth(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy is `SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE`.

Parameters:
  `sb` - Scroll bar.

### getMemoryUsage

public static String getMemoryUsage()
Returns the memory usage string.

Returns:
  The memory usage string.

### createTrackListener

protected BasicScrollBarUI.TrackListener createTrackListener()

Overrides:
  `createTrackListener` in class `BasicScrollBarUI`

### createArrowButtonListener

protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()

Overrides:
  `createArrowButtonListener` in class `BasicScrollBarUI`

### getPreferredSize

public Dimension getPreferredSize(JComponent c)

Overrides:
  `getPreferredSize` in class `BasicScrollBarUI`