javax.swing.plaf.metal
public class MetalScrollBarUI extends BasicScrollBarUI
JScrollBar
component.BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener
Modifier and Type | Field and Description |
---|---|
protected MetalScrollButton |
decreaseButton
The button that decreases the value in the scroll bar.
|
static String |
FREE_STANDING_PROP
The name for the 'free standing' property.
|
protected MetalScrollButton |
increaseButton
The button that increases the value in the scroll bar.
|
protected boolean |
isFreeStanding
A flag that indicates whether the scroll bar is "free standing", which
means it has complete borders and can be used anywhere in the UI.
|
protected int |
scrollBarWidth
The scroll bar width.
|
buttonListener, decrButton, DECREASE_HIGHLIGHT, incrButton, INCREASE_HIGHLIGHT, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollListener, scrollTimer, thumbColor, thumbDarkShadowColor, thumbHighlightColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
MetalScrollBarUI()
Constructs a new instance of
MetalScrollBarUI , with no
specific initialisation. |
Modifier and Type | Method and Description |
---|---|
protected JButton |
createDecreaseButton(int orientation)
Creates a new button to use as the control at the lower end of the
JScrollBar . |
protected JButton |
createIncreaseButton(int orientation)
Creates a new button to use as the control at the upper end of the
JScrollBar . |
protected PropertyChangeListener |
createPropertyChangeListener()
Creates a property change listener for the delegate to use.
|
static ComponentUI |
createUI(JComponent component)
Returns a new instance of
MetalScrollBarUI . |
protected Dimension |
getMinimumThumbSize()
Returns the minimum thumb size.
|
Dimension |
getPreferredSize(JComponent c)
Returns the
preferredSize for the specified scroll bar. |
protected void |
installDefaults()
Installs the defaults.
|
protected void |
paintThumb(Graphics g,
JComponent c,
Rectangle thumbBounds)
Paints the slider button of the ScrollBar.
|
protected void |
paintTrack(Graphics g,
JComponent c,
Rectangle trackBounds)
Paints the track for the scrollbar.
|
addLayoutComponent, configureScrollBarColors, createArrowButtonListener, createModelListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getMinimumSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installComponents, installKeyboardActions, installListeners, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paint, paintDecreaseHighlight, paintIncreaseHighlight, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbBounds, setThumbRollover, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
public static final String FREE_STANDING_PROP
protected MetalScrollButton increaseButton
protected MetalScrollButton decreaseButton
protected int scrollBarWidth
protected boolean isFreeStanding
public MetalScrollBarUI()
MetalScrollBarUI
, with no
specific initialisation.public static ComponentUI createUI(JComponent component)
MetalScrollBarUI
.component
- the component for which we return an UI instanceprotected void installDefaults()
installDefaults
in class BasicScrollBarUI
protected PropertyChangeListener createPropertyChangeListener()
MetalLookAndFeel
that can handle the
JScrollBar.isFreeStanding
property.createPropertyChangeListener
in class BasicScrollBarUI
protected JButton createDecreaseButton(int orientation)
JScrollBar
. This method assigns the new button (an instance of
MetalScrollButton
to the decreaseButton
field, and also
returns the button. The button width is determined by the
ScrollBar.width
setting in the UI defaults.createDecreaseButton
in class BasicScrollBarUI
orientation
- the orientation of the button (SwingConstants.NORTH
,
SwingConstants.SOUTH
, SwingConstants.EAST
or SwingConstants.WEST
).protected JButton createIncreaseButton(int orientation)
JScrollBar
. This method assigns the new button (an instance of
MetalScrollButton
to the increaseButton
field, and also
returns the button. The button width is determined by the
ScrollBar.width
setting in the UI defaults.createIncreaseButton
in class BasicScrollBarUI
orientation
- the orientation of the button (SwingConstants.NORTH
,
SwingConstants.SOUTH
, SwingConstants.EAST
or SwingConstants.WEST
).protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
paintTrack
in class BasicScrollBarUI
g
- the graphics device.c
- the component.trackBounds
- the track bounds.protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
paintThumb
in class BasicScrollBarUI
g
- the Graphics context to usec
- the JComponent on which we paintthumbBounds
- the rectangle that is the slider buttonprotected Dimension getMinimumThumbSize()
17 x 17
pixels, whereas for a non free
standing scroll bar the minimum size is 15 x 15
pixels.getMinimumThumbSize
in class BasicScrollBarUI
public Dimension getPreferredSize(JComponent c)
preferredSize
for the specified scroll bar.
For a vertical scrollbar the height is the sum of the preferred heights
of the buttons plus 30
. The width is fetched from the
UIManager
property ScrollBar.width
.
For horizontal scrollbars the width is the sum of the preferred widths
of the buttons plus 30
. The height is fetched from the
UIManager
property ScrollBar.height
.getPreferredSize
in class BasicScrollBarUI
c
- the scrollbar for which to calculate the preferred sizepreferredSize
for the specified scroll bar