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 classSubstanceScrollBarUI.SubstanceArrowButtonListenerListener on arrow buttons.protected classSubstanceScrollBarUI.SubstanceTrackListenerTrack 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.CompositeButtonModelcompositeScrollTrackModelSurrogate model to sync between rollover effects of scroll buttons and scroll track / scroll thumb.protected StateTransitionTrackercompositeStateTransitionTrackerprotected JButtonmySecondDecreaseButtonThe second decrease button.protected JButtonmySecondIncreaseButtonThe second increase button.protected intscrollBarWidthScroll bar width.protected AdjustmentListenersubstanceAdjustmentListenerListener 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 protectedSubstanceScrollBarUI(JComponent b)Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BasicScrollBarUI.ArrowButtonListenercreateArrowButtonListener()protected JButtoncreateDecreaseButton(int orientation)protected JButtoncreateGeneralDecreaseButton(int orientation, boolean isRegular)Creates a decrease button.protected JButtoncreateGeneralIncreaseButton(int orientation, boolean isRegular)Creates a increase button.protected JButtoncreateIncreaseButton(int orientation)protected BasicScrollBarUI.TrackListenercreateTrackListener()static ComponentUIcreateUI(JComponent comp)static StringgetMemoryUsage()Returns the memory usage string.DimensiongetPreferredSize(JComponent c)protected ComponentStategetState(JButton scrollButton)Returns the scroll button state.StateTransitionTrackergetTransitionTracker()Returns the model for tracking the transitions.protected voidinstallComponents()protected voidinstallDefaults()protected voidinstallListeners()booleanisInside(MouseEvent me)Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.protected voidlayoutHScrollbar(JScrollBar sb)protected voidlayoutHScrollbarAdjacent(JScrollBar sb)Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT.protected voidlayoutHScrollbarMultiple(JScrollBar sb)Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE.protected voidlayoutHScrollbarMultipleBoth(JScrollBar sb)Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE.protected voidlayoutHScrollbarNone(JScrollBar sb)Lays out the horizontal scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.NONE.protected voidlayoutVScrollbar(JScrollBar sb)protected voidlayoutVScrollbarAdjacent(JScrollBar sb)Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT.protected voidlayoutVScrollbarMultiple(JScrollBar sb)Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE.protected voidlayoutVScrollbarMultipleBoth(JScrollBar sb)Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTH.protected voidlayoutVScrollbarNone(JScrollBar sb)Lays out the vertical scroll bar when the button policy isSubstanceConstants.ScrollPaneButtonPolicyKind.ADJACENT.voidpaint(Graphics g, JComponent c)protected voidpaintThumb(Graphics g, JComponent c, Rectangle thumbBounds)protected voidpaintTrack(Graphics g, JComponent c, Rectangle trackBounds)voidscrollByBlock(int direction)voidscrollByUnits(int direction, int units)Scrolls the associated scroll bar.protected voiduninstallComponents()protected voiduninstallListeners()-
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.MULTIPLEandSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTHmodes.- Since:
- version 3.1
-
mySecondIncreaseButton
protected JButton mySecondIncreaseButton
The second increase button. Is shown only underSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTHmode.- 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.MULTIPLEandSubstanceConstants.ScrollPaneButtonPolicyKind.MULTIPLE_BOTHkinds.- Returns:
- Decrease button.
-
createDecreaseButton
protected JButton createDecreaseButton(int orientation)
- Overrides:
createDecreaseButtonin classBasicScrollBarUI
-
createIncreaseButton
protected JButton createIncreaseButton(int orientation)
- Overrides:
createIncreaseButtonin 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_BOTHkind.- 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:
paintTrackin classBasicScrollBarUI
-
paintThumb
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
- Overrides:
paintThumbin classBasicScrollBarUI
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paintin classBasicScrollBarUI
-
installDefaults
protected void installDefaults()
- Overrides:
installDefaultsin classBasicScrollBarUI
-
installComponents
protected void installComponents()
- Overrides:
installComponentsin classBasicScrollBarUI
-
uninstallComponents
protected void uninstallComponents()
- Overrides:
uninstallComponentsin classBasicScrollBarUI
-
installListeners
protected void installListeners()
- Overrides:
installListenersin classBasicScrollBarUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListenersin classBasicScrollBarUI
-
isInside
public boolean isInside(MouseEvent me)
Description copied from interface:TransitionAwareUIChecks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.- Specified by:
isInsidein interfaceTransitionAwareUI- Parameters:
me- Mouse event.- Returns:
trueif the mouse position of the specified event lies inside the area of the component designated for transition effects,falseotherwise.
-
getTransitionTracker
public StateTransitionTracker getTransitionTracker()
Description copied from interface:TransitionAwareUIReturns the model for tracking the transitions.- Specified by:
getTransitionTrackerin interfaceTransitionAwareUI- Returns:
- Model for tracking the transitions.
-
scrollByBlock
public void scrollByBlock(int direction)
- Overrides:
scrollByBlockin 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:
layoutVScrollbarin classBasicScrollBarUI
-
layoutHScrollbar
protected void layoutHScrollbar(JScrollBar sb)
- Overrides:
layoutHScrollbarin 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:
createTrackListenerin classBasicScrollBarUI
-
createArrowButtonListener
protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
- Overrides:
createArrowButtonListenerin classBasicScrollBarUI
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSizein classBasicScrollBarUI
-
-