public class ButtonsTogetherScrollBarSkin extends Object implements ScrollBarSkin
ScrollBarSkin
with the buttons placed at the bottom or right of the scroll bar.Constructor and Description |
---|
ButtonsTogetherScrollBarSkin(JComponent scrollBarCap,
AbstractButton decrementButton,
AbstractButton incrementButton,
Painter<Component> trackPainter,
Painter<Component> scrollThumbPainter,
int scrollBarCapRecess,
int decrementButtonRecess,
Dimension minimumThumbSize,
Dimension preferredSize)
Creates a
ButtonsTogetherScrollBarSkin using the given parameters. |
Modifier and Type | Method and Description |
---|---|
Dimension |
getMinimumThumbSize()
The smallest size that the scroll thumb can be.
|
Dimension |
getPreferredSize()
The preferred size of the painter, which will control the preferred size of the associated
JScrollBar . |
Rectangle |
getScrollThumbBounds()
Gets the current bounds of the scroll thumb, which are controlled by the layout provided by
this skin.
|
Rectangle |
getTrackBounds()
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.
|
public ButtonsTogetherScrollBarSkin(JComponent scrollBarCap, AbstractButton decrementButton, AbstractButton incrementButton, Painter<Component> trackPainter, Painter<Component> scrollThumbPainter, int scrollBarCapRecess, int decrementButtonRecess, Dimension minimumThumbSize, Dimension preferredSize)
ButtonsTogetherScrollBarSkin
using the given 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
- the Painter
to use to paint the track.scrollThumbPainter
- the Painter
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.public Dimension getMinimumThumbSize()
ScrollBarSkin
getMinimumThumbSize
in interface ScrollBarSkin
public Dimension getPreferredSize()
ScrollBarSkin
JScrollBar
. For vertical scroll bars, this value will drive the width. For horiztonal
scroll bars, this value will drive the height.getPreferredSize
in interface ScrollBarSkin
JScrollBar
.public Rectangle getScrollThumbBounds()
ScrollBarSkin
getScrollThumbBounds
in interface ScrollBarSkin
public Rectangle getTrackBounds()
ScrollBarSkin
JScrollBar
, but only the bounds that are valid for the
scroll thumb to exist in.getTrackBounds
in interface ScrollBarSkin
public void installComponents(JScrollBar scrollBar)
ScrollBarSkin
ScrollBarSkin.layoutTrackOnly(JScrollBar, ScrollBarOrientation)
and ScrollBarSkin.layoutEverything(JScrollBar, ScrollBarOrientation)
.installComponents
in interface ScrollBarSkin
scrollBar
- the JScrollBar
that the skin will be painting.public void layoutTrackOnly(JScrollBar scrollBar, ScrollBarOrientation orientation)
ScrollBarSkin
JScrollBar
has been set to ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
or ScrollPaneConstants.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.layoutTrackOnly
in interface ScrollBarSkin
scrollBar
- the JScrollBar
that the skin is painting.orientation
- the orientation of the scroll bar.public void layoutEverything(JScrollBar scrollBar, ScrollBarOrientation orientation)
ScrollBarSkin
layoutEverything
in interface ScrollBarSkin
scrollBar
- the JScrollBar
that the skin is painting.orientation
- the orientation of the scroll bar.public void installMouseListenersOnButtons(MouseListener decrementMoustListener, MouseListener incrementMouseListener)
ScrollBarSkin
installMouseListenersOnButtons
in interface ScrollBarSkin
decrementMoustListener
- the MouseListener
to be notified when a control is
pressed that should result in the scroll bar's value decrementing.incrementMouseListener
- the MouseListener
to be notified when a control is
pressed that should result in the scroll bar's value incrementing.public void setScrollThumbBounds(Rectangle bounds)
ScrollBarSkin
JScrollBar
's BoundedRangeModel
is updated.setScrollThumbBounds
in interface ScrollBarSkin
bounds
- the new bounds of the scroll thumb.