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
All Methods Static Methods Instance Methods Concrete Methods 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 isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
.protected void
layoutHScrollbarMultiple(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
.protected void
layoutHScrollbarMultipleBoth(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
.protected void
layoutHScrollbarNone(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.NONE
.protected void
layoutVScrollbar(JScrollBar sb)
protected void
layoutVScrollbarAdjacent(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
.protected void
layoutVScrollbarMultiple(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
.protected void
layoutVScrollbarMultipleBoth(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH
.protected void
layoutVScrollbarNone(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.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
-
-
-
-
Field Detail
-
mySecondDecreaseButton
protected JButton mySecondDecreaseButton
The second decrease button. Is shown underSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
,SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
andSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH
modes.- Since:
- version 3.1
-
mySecondIncreaseButton
protected JButton mySecondIncreaseButton
The second increase button. Is shown only underSubstanceConstants.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 Detail
-
SubstanceScrollBarUI
protected SubstanceScrollBarUI(JComponent b)
Simple constructor.- Parameters:
b
- Associated component.
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent comp)
-
createGeneralDecreaseButton
protected JButton createGeneralDecreaseButton(int orientation, boolean isRegular)
Creates a decrease button.- Parameters:
orientation
- Button orientation.isRegular
- iftrue
, the regular (upper / left) decrease button is created, iffalse
, the additional (lower / right) decrease button is created forSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
,SubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
andSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH
kinds.- Returns:
- Decrease button.
-
createDecreaseButton
protected JButton createDecreaseButton(int orientation)
- Overrides:
createDecreaseButton
in classBasicScrollBarUI
-
createIncreaseButton
protected JButton createIncreaseButton(int orientation)
- Overrides:
createIncreaseButton
in classBasicScrollBarUI
-
createGeneralIncreaseButton
protected JButton createGeneralIncreaseButton(int orientation, boolean isRegular)
Creates a increase button.- Parameters:
orientation
- Button orientation.isRegular
- iftrue
, the regular (lower / right) increase button is created, iffalse
, the additional (upper / left) increase button is created forSubstanceConstants.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 classBasicScrollBarUI
-
paintThumb
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
- Overrides:
paintThumb
in classBasicScrollBarUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paint
in classBasicScrollBarUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaults
in classBasicScrollBarUI
-
installComponents
protected void installComponents()
- Overrides:
installComponents
in classBasicScrollBarUI
-
uninstallComponents
protected void uninstallComponents()
- Overrides:
uninstallComponents
in classBasicScrollBarUI
-
installListeners
protected void installListeners()
- Overrides:
installListeners
in classBasicScrollBarUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListeners
in classBasicScrollBarUI
-
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 interfaceTransitionAwareUI
- 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 interfaceTransitionAwareUI
- Returns:
- Model for tracking the transitions.
-
scrollByBlock
public void scrollByBlock(int direction)
- Overrides:
scrollByBlock
in classBasicScrollBarUI
-
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 classBasicScrollBarUI
-
layoutHScrollbar
protected void layoutHScrollbar(JScrollBar sb)
- Overrides:
layoutHScrollbar
in classBasicScrollBarUI
-
layoutVScrollbarAdjacent
protected void layoutVScrollbarAdjacent(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
.- Parameters:
sb
- Scroll bar.
-
layoutVScrollbarNone
protected void layoutVScrollbarNone(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
.- Parameters:
sb
- Scroll bar.
-
layoutVScrollbarMultiple
protected void layoutVScrollbarMultiple(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
.- Parameters:
sb
- Scroll bar.
-
layoutVScrollbarMultipleBoth
protected void layoutVScrollbarMultipleBoth(JScrollBar sb)
Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH
.- Parameters:
sb
- Scroll bar.
-
layoutHScrollbarAdjacent
protected void layoutHScrollbarAdjacent(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT
.- Parameters:
sb
- Scroll bar.
-
layoutHScrollbarNone
protected void layoutHScrollbarNone(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.NONE
.- Parameters:
sb
- Scroll bar.
-
layoutHScrollbarMultiple
protected void layoutHScrollbarMultiple(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE
.- Parameters:
sb
- Scroll bar.
-
layoutHScrollbarMultipleBoth
protected void layoutHScrollbarMultipleBoth(JScrollBar sb)
Lays out the horizontal scroll bar when the button policy isSubstanceConstants.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 classBasicScrollBarUI
-
createArrowButtonListener
protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
- Overrides:
createArrowButtonListener
in classBasicScrollBarUI
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSize
in classBasicScrollBarUI
-
-