Package com.explodingpixels.widgets.plaf
Class ButtonsSeparateScrollBarSkin
- java.lang.Object
-
- com.explodingpixels.widgets.plaf.ButtonsSeparateScrollBarSkin
-
- All Implemented Interfaces:
ScrollBarSkin
public class ButtonsSeparateScrollBarSkin extends java.lang.Object implements ScrollBarSkin
AScrollBarSkinwith the buttons placed at the bottom or right of the scroll bar.
-
-
Constructor Summary
Constructors Constructor Description ButtonsSeparateScrollBarSkin(javax.swing.AbstractButton decrementButton, javax.swing.AbstractButton incrementButton, MacWidgetsPainter<java.awt.Component> trackPainter, MacWidgetsPainter<java.awt.Component> scrollThumbPainter, int decrementButtonRecess, int incrementButtonRecess, java.awt.Dimension minimumThumbSize, java.awt.Dimension preferredSize)Creates aButtonsTogetherScrollBarSkinusing the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.DimensiongetMinimumThumbSize()The smallest size that the scroll thumb can be.java.awt.DimensiongetPreferredSize()The preferred size of the painter, which will control the preferred size of the associatedJScrollBar.java.awt.RectanglegetScrollThumbBounds()Gets the current bounds of the scroll thumb, which are controlled by the layout provided by this skin.java.awt.RectanglegetTrackBounds()Gets the current bounds of the track, which are controlled by the layout provided by this skin.voidinstallComponents(javax.swing.JScrollBar scrollBar)Called once at the begining of the skin's life cycle.voidinstallMouseListenersOnButtons(java.awt.event.MouseListener decrementMoustListener, java.awt.event.MouseListener incrementMouseListener)Called once at the begining of the skin's life cycle.voidlayoutEverything(javax.swing.JScrollBar scrollBar, ScrollBarOrientation orientation)Called when scroll bar should be laid out by the skin.voidlayoutTrackOnly(javax.swing.JScrollBar scrollBar, ScrollBarOrientation orientation)Called when only the track should be laid out by the skin.voidsetScrollThumbBounds(java.awt.Rectangle bounds)Sets the bounds of the scroll thumb.
-
-
-
Constructor Detail
-
ButtonsSeparateScrollBarSkin
public ButtonsSeparateScrollBarSkin(javax.swing.AbstractButton decrementButton, javax.swing.AbstractButton incrementButton, MacWidgetsPainter<java.awt.Component> trackPainter, MacWidgetsPainter<java.awt.Component> scrollThumbPainter, int decrementButtonRecess, int incrementButtonRecess, java.awt.Dimension minimumThumbSize, java.awt.Dimension preferredSize)Creates aButtonsTogetherScrollBarSkinusing the given parameters.- Parameters:
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- theMacWidgetsPainterto use to paint the track.scrollThumbPainter- theMacWidgetsPainterto use to paint the scroll thumb.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.incrementButtonRecess- the number of pixels to allow the scrollbar to "recess" into the increment 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 Detail
-
getMinimumThumbSize
public java.awt.Dimension getMinimumThumbSize()
Description copied from interface:ScrollBarSkinThe smallest size that the scroll thumb can be.- Specified by:
getMinimumThumbSizein interfaceScrollBarSkin- Returns:
- the mimimum size of the scroll thumb.
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Description copied from interface:ScrollBarSkinThe 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:
getPreferredSizein interfaceScrollBarSkin- Returns:
- the preferred size of this painter, and thus the corresponding
JScrollBar.
-
getScrollThumbBounds
public java.awt.Rectangle getScrollThumbBounds()
Description copied from interface:ScrollBarSkinGets the current bounds of the scroll thumb, which are controlled by the layout provided by this skin.- Specified by:
getScrollThumbBoundsin interfaceScrollBarSkin- Returns:
- the current bounds of the scroll thumb.
-
getTrackBounds
public java.awt.Rectangle getTrackBounds()
Description copied from interface:ScrollBarSkinGets 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:
getTrackBoundsin interfaceScrollBarSkin- Returns:
- the current bounds of the track.
-
installComponents
public void installComponents(javax.swing.JScrollBar scrollBar)
Description copied from interface:ScrollBarSkinCalled 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:
installComponentsin interfaceScrollBarSkin- Parameters:
scrollBar- theJScrollBarthat the skin will be painting.
-
layoutTrackOnly
public void layoutTrackOnly(javax.swing.JScrollBar scrollBar, ScrollBarOrientation orientation)Description copied from interface:ScrollBarSkinCalled 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.- Specified by:
layoutTrackOnlyin interfaceScrollBarSkin- Parameters:
scrollBar- theJScrollBarthat the skin is painting.orientation- the orientation of the scroll bar.
-
layoutEverything
public void layoutEverything(javax.swing.JScrollBar scrollBar, ScrollBarOrientation orientation)Description copied from interface:ScrollBarSkinCalled when scroll bar should be laid out by the skin.- Specified by:
layoutEverythingin interfaceScrollBarSkin- Parameters:
scrollBar- theJScrollBarthat the skin is painting.orientation- the orientation of the scroll bar.
-
installMouseListenersOnButtons
public void installMouseListenersOnButtons(java.awt.event.MouseListener decrementMoustListener, java.awt.event.MouseListener incrementMouseListener)Description copied from interface:ScrollBarSkinCalled 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:
installMouseListenersOnButtonsin interfaceScrollBarSkin- 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.
-
setScrollThumbBounds
public void setScrollThumbBounds(java.awt.Rectangle bounds)
Description copied from interface:ScrollBarSkinSets the bounds of the scroll thumb. This method will be called, for example, when the associatedJScrollBar'sBoundedRangeModelis updated.- Specified by:
setScrollThumbBoundsin interfaceScrollBarSkin- Parameters:
bounds- the new bounds of the scroll thumb.
-
-