Package com.explodingpixels.widgets.plaf
Class ButtonsTogetherScrollBarSkin
java.lang.Object
com.explodingpixels.widgets.plaf.ButtonsTogetherScrollBarSkin
- All Implemented Interfaces:
ScrollBarSkin
A
ScrollBarSkin
with the buttons placed at the bottom or right of the scroll bar.-
Constructor Summary
ConstructorsConstructorDescriptionButtonsTogetherScrollBarSkin
(JComponent scrollBarCap, AbstractButton decrementButton, AbstractButton incrementButton, MacWidgetsPainter<Component> trackPainter, MacWidgetsPainter<Component> scrollThumbPainter, int scrollBarCapRecess, int decrementButtonRecess, Dimension minimumThumbSize, Dimension preferredSize) Creates aButtonsTogetherScrollBarSkin
using the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionThe smallest size that the scroll thumb can be.The preferred size of the painter, which will control the preferred size of the associatedJScrollBar
.Gets the current bounds of the scroll thumb, which are controlled by the layout provided by this skin.Gets the current bounds of the track, which are controlled by the layout provided by this skin.void
installComponents
(JScrollBar scrollBar) Called once at the begining of the skin's life cycle.void
installMouseListenersOnButtons
(MouseListener decrementMoustListener, MouseListener incrementMouseListener) Called once at the begining of the skin's life cycle.void
layoutEverything
(JScrollBar scrollBar, ScrollBarOrientation orientation) Called when scroll bar should be laid out by the skin.void
layoutTrackOnly
(JScrollBar scrollBar, ScrollBarOrientation orientation) Called when only the track should be laid out by the skin.void
setScrollThumbBounds
(Rectangle bounds) Sets the bounds of the scroll thumb.
-
Constructor Details
-
ButtonsTogetherScrollBarSkin
public ButtonsTogetherScrollBarSkin(JComponent scrollBarCap, AbstractButton decrementButton, AbstractButton incrementButton, MacWidgetsPainter<Component> trackPainter, MacWidgetsPainter<Component> scrollThumbPainter, int scrollBarCapRecess, int decrementButtonRecess, Dimension minimumThumbSize, Dimension preferredSize) Creates aButtonsTogetherScrollBarSkin
using the given parameters.- Parameters:
scrollBarCap
- the component to draw adjacent to the scroll tracks minimum value side.decrementButton
- the button to cause a decrement in the scroll bar to occur.incrementButton
- the button to cause a increment in the scroll bar to occur.trackPainter
- theMacWidgetsPainter
to use to paint the track.scrollThumbPainter
- theMacWidgetsPainter
to use to paint the scroll thumb.scrollBarCapRecess
- the number of pixels to allow the scrollbar to "recess" into the scroll bar cap. this is useful when using scroll bars with rounded ends.decrementButtonRecess
- the number of pixels to allow the scrollbar to "recess" into the decrement button. this is useful when using scroll bars with rounded ends.minimumThumbSize
- the minimum size that the scroll thumb can be.preferredSize
- the preferred size of this skin.
-
-
Method Details
-
getMinimumThumbSize
Description copied from interface:ScrollBarSkin
The smallest size that the scroll thumb can be.- Specified by:
getMinimumThumbSize
in interfaceScrollBarSkin
- Returns:
- the mimimum size of the scroll thumb.
-
getPreferredSize
Description copied from interface:ScrollBarSkin
The preferred size of the painter, which will control the preferred size of the associatedJScrollBar
. For vertical scroll bars, this value will drive the width. For horiztonal scroll bars, this value will drive the height.- Specified by:
getPreferredSize
in interfaceScrollBarSkin
- Returns:
- the preferred size of this painter, and thus the corresponding
JScrollBar
.
-
getScrollThumbBounds
Description copied from interface:ScrollBarSkin
Gets the current bounds of the scroll thumb, which are controlled by the layout provided by this skin.- Specified by:
getScrollThumbBounds
in interfaceScrollBarSkin
- Returns:
- the current bounds of the scroll thumb.
-
getTrackBounds
Description copied from interface:ScrollBarSkin
Gets the current bounds of the track, which are controlled by the layout provided by this skin. Note that the bounds returned by this method should be the actual scrollable bounds that the scroll thumb can move in. That is, this value should not just return the bounds of the associatedJScrollBar
, but only the bounds that are valid for the scroll thumb to exist in.- Specified by:
getTrackBounds
in interfaceScrollBarSkin
- Returns:
- the current bounds of the track.
-
installComponents
Description copied from interface:ScrollBarSkin
Called once at the begining of the skin's life cycle. Implementors should add components that will later be controlled inScrollBarSkin.layoutTrackOnly(JScrollBar, ScrollBarOrientation)
andScrollBarSkin.layoutEverything(JScrollBar, ScrollBarOrientation)
.- Specified by:
installComponents
in interfaceScrollBarSkin
- Parameters:
scrollBar
- theJScrollBar
that the skin will be painting.
-
layoutTrackOnly
Description copied from interface:ScrollBarSkin
Called when only the track should be laid out by the skin. This occurs when aJScrollBar
has been set toScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
orScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
and the corresponding view is showing all the content. Note that there are, in fact, no restrictions on what this method lays out. That is, if this skin wishes to layout more than just an empty track when there is no content to scroll, it may do so.- Specified by:
layoutTrackOnly
in interfaceScrollBarSkin
- Parameters:
scrollBar
- theJScrollBar
that the skin is painting.orientation
- the orientation of the scroll bar.
-
layoutEverything
Description copied from interface:ScrollBarSkin
Called when scroll bar should be laid out by the skin.- Specified by:
layoutEverything
in interfaceScrollBarSkin
- Parameters:
scrollBar
- theJScrollBar
that the skin is painting.orientation
- the orientation of the scroll bar.
-
installMouseListenersOnButtons
public void installMouseListenersOnButtons(MouseListener decrementMoustListener, MouseListener incrementMouseListener) Description copied from interface:ScrollBarSkin
Called once at the begining of the skin's life cycle. Implementors should attach these mouse listners to the controls that decrement and increment the scroll bar's value.- Specified by:
installMouseListenersOnButtons
in interfaceScrollBarSkin
- Parameters:
decrementMoustListener
- theMouseListener
to be notified when a control is pressed that should result in the scroll bar's value decrementing.incrementMouseListener
- theMouseListener
to be notified when a control is pressed that should result in the scroll bar's value incrementing.
-
setScrollThumbBounds
Description copied from interface:ScrollBarSkin
Sets the bounds of the scroll thumb. This method will be called, for example, when the associatedJScrollBar
'sBoundedRangeModel
is updated.- Specified by:
setScrollThumbBounds
in interfaceScrollBarSkin
- Parameters:
bounds
- the new bounds of the scroll thumb.
-