javax.swing.plaf.metal

Class MetalScrollBarUI

Implemented Interfaces:
LayoutManager, SwingConstants

public class MetalScrollBarUI
extends BasicScrollBarUI

Implementation of ScrollBarUI for the Metal Look and Feel

Nested Class Summary

Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicScrollBarUI

BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener

Field Summary

static String
FREE_STANDING_PROP
protected javax.swing.plaf.metal.MetalBumps
bumps
protected MetalScrollButton
decreaseButton
protected MetalScrollButton
increaseButton
protected boolean
isFreeStanding
protected int
scrollBarWidth
Hint as to what width (when vertical) or height (when horizontal) should be.

Fields inherited from class javax.swing.plaf.basic.BasicScrollBarUI

DECREASE_HIGHLIGHT, INCREASE_HIGHLIGHT, NO_HIGHLIGHT, buttonListener, decrButton, incrButton, isDragging, maximumThumbSize, minimumThumbSize, modelListener, propertyChangeListener, scrollListener, scrollTimer, scrollbar, thumbColor, thumbDarkShadowColor, thumbHighlightColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect

Fields inherited from interface javax.swing.SwingConstants

BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST

Method Summary

protected void
configureScrollBarColors()
protected JButton
createDecreaseButton(int orientation)
Returns the view that represents the decrease view.
protected JButton
createIncreaseButton(int orientation)
Returns the view that represents the increase view.
protected PropertyChangeListener
createPropertyChangeListener()
static ComponentUI
createUI(JComponent c)
Returns an instance of the UI delegate for the specified component.
protected Dimension
getMinimumThumbSize()
Return the smallest acceptable size for the thumb.
Dimension
getPreferredSize(JComponent c)
A vertical scrollbar's preferred width is the maximum of preferred widths of the (non null) increment/decrement buttons, and the minimum width of the thumb.
protected void
installDefaults()
protected void
installListeners()
protected void
paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
protected void
paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
protected void
setThumbBounds(int x, int y, int width, int height)
This is overridden only to increase the invalid area.

Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI

addLayoutComponent, configureScrollBarColors, createArrowButtonListener, createDecreaseButton, createIncreaseButton, createModelListener, createPropertyChangeListener, createScrollListener, createTrackListener, createUI, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getPreferredSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paint, paintDecreaseHighlight, paintIncreaseHighlight, paintThumb, paintTrack, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbBounds, setThumbRollover, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI

Methods inherited from class javax.swing.plaf.ComponentUI

contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

FREE_STANDING_PROP

public static final String FREE_STANDING_PROP
Field Value:
"JScrollBar.isFreeStanding"

bumps

protected javax.swing.plaf.metal.MetalBumps bumps

decreaseButton

protected MetalScrollButton decreaseButton

increaseButton

protected MetalScrollButton increaseButton

isFreeStanding

protected boolean isFreeStanding

scrollBarWidth

protected int scrollBarWidth
Hint as to what width (when vertical) or height (when horizontal) should be.

Method Details

configureScrollBarColors

protected void configureScrollBarColors()
Overrides:
configureScrollBarColors in interface BasicScrollBarUI

createDecreaseButton

protected JButton createDecreaseButton(int orientation)
Returns the view that represents the decrease view.
Overrides:
createDecreaseButton in interface BasicScrollBarUI

createIncreaseButton

protected JButton createIncreaseButton(int orientation)
Returns the view that represents the increase view.
Overrides:
createIncreaseButton in interface BasicScrollBarUI

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()
Overrides:
createPropertyChangeListener in interface BasicScrollBarUI

createUI

public static ComponentUI createUI(JComponent c)
Returns an instance of the UI delegate for the specified component. Each subclass must provide its own static createUI method that returns an instance of that UI delegate subclass. If the UI delegate subclass is stateless, it may return an instance that is shared by multiple components. If the UI delegate is stateful, then it should return a new instance per component. The default implementation of this method throws an error, as it should never be invoked.
Overrides:
createUI in interface BasicScrollBarUI

getMinimumThumbSize

protected Dimension getMinimumThumbSize()
Return the smallest acceptable size for the thumb. If the scrollbar becomes so small that this size isn't available, the thumb will be hidden.

Warning : the value returned by this method should not be be modified, it's a shared static constant.

Overrides:
getMinimumThumbSize in interface BasicScrollBarUI
Returns:
The smallest acceptable size for the thumb.

getPreferredSize

public Dimension getPreferredSize(JComponent c)
A vertical scrollbar's preferred width is the maximum of preferred widths of the (non null) increment/decrement buttons, and the minimum width of the thumb. The preferred height is the sum of the preferred heights of the same parts. The basis for the preferred size of a horizontal scrollbar is similar.

The preferredSize is only computed once, subsequent calls to this method just return a cached size.

Overrides:
getPreferredSize in interface BasicScrollBarUI
Parameters:
c - the JScrollBar that's delegating this method to us
Returns:
the preferred size of a Basic JScrollBar

installDefaults

protected void installDefaults()
Overrides:
installDefaults in interface BasicScrollBarUI

installListeners

protected void installListeners()
Overrides:
installListeners in interface BasicScrollBarUI

paintThumb

protected void paintThumb(Graphics g,
                          JComponent c,
                          Rectangle thumbBounds)
Overrides:
paintThumb in interface BasicScrollBarUI

paintTrack

protected void paintTrack(Graphics g,
                          JComponent c,
                          Rectangle trackBounds)
Overrides:
paintTrack in interface BasicScrollBarUI

setThumbBounds

protected void setThumbBounds(int x,
                              int y,
                              int width,
                              int height)
This is overridden only to increase the invalid area. This ensures that the "Shadow" below the thumb is invalidated
Overrides:
setThumbBounds in interface BasicScrollBarUI