Package com.explodingpixels.widgets.plaf
Interface ScrollBarSkin
- All Known Implementing Classes:
ButtonsSeparateScrollBarSkin,ButtonsTogetherScrollBarSkin
public interface ScrollBarSkin
An interface that allows implementors to control the appearance of a
JScrollBar.-
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.voidinstallComponents(JScrollBar scrollBar) Called once at the begining of the skin's life cycle.voidinstallMouseListenersOnButtons(MouseListener decrementMoustListener, MouseListener incrementMouseListener) Called once at the begining of the skin's life cycle.voidlayoutEverything(JScrollBar scrollBar, ScrollBarOrientation orientation) Called when scroll bar should be laid out by the skin.voidlayoutTrackOnly(JScrollBar scrollBar, ScrollBarOrientation orientation) Called when only the track should be laid out by the skin.voidsetScrollThumbBounds(Rectangle bounds) Sets the bounds of the scroll thumb.
-
Method Details
-
installComponents
Called once at the begining of the skin's life cycle. Implementors should add components that will later be controlled inlayoutTrackOnly(JScrollBar, ScrollBarOrientation)andlayoutEverything(JScrollBar, ScrollBarOrientation).- Parameters:
scrollBar- theJScrollBarthat the skin will be painting.
-
installMouseListenersOnButtons
void installMouseListenersOnButtons(MouseListener decrementMoustListener, MouseListener incrementMouseListener) 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.- Parameters:
decrementMoustListener- theMouseListenerto be notified when a control is pressed that should result in the scroll bar's value decrementing.incrementMouseListener- theMouseListenerto be notified when a control is pressed that should result in the scroll bar's value incrementing.
-
layoutTrackOnly
Called when only the track should be laid out by the skin. This occurs when aJScrollBarhas been set toScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYSorScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYSand 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.- Parameters:
scrollBar- theJScrollBarthat the skin is painting.orientation- the orientation of the scroll bar.
-
layoutEverything
Called when scroll bar should be laid out by the skin.- Parameters:
scrollBar- theJScrollBarthat the skin is painting.orientation- the orientation of the scroll bar.
-
getMinimumThumbSize
Dimension getMinimumThumbSize()The smallest size that the scroll thumb can be.- Returns:
- the mimimum size of the scroll thumb.
-
getPreferredSize
Dimension getPreferredSize()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.- Returns:
- the preferred size of this painter, and thus the corresponding
JScrollBar.
-
getScrollThumbBounds
Rectangle getScrollThumbBounds()Gets the current bounds of the scroll thumb, which are controlled by the layout provided by this skin.- Returns:
- the current bounds of the scroll thumb.
-
setScrollThumbBounds
Sets the bounds of the scroll thumb. This method will be called, for example, when the associatedJScrollBar'sBoundedRangeModelis updated.- Parameters:
bounds- the new bounds of the scroll thumb.
-
getTrackBounds
Rectangle getTrackBounds()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.- Returns:
- the current bounds of the track.
-