Class MetalScrollBarUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ScrollBarUI
javax.swing.plaf.basic.BasicScrollBarUI
javax.swing.plaf.metal.MetalScrollBarUI
- All Implemented Interfaces:
LayoutManager, SwingConstants
Implementation of ScrollBarUI for the Metal Look and Feel
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicScrollBarUI
BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MetalScrollButtonThe decrease button.static final StringThe propertyJScrollBar.isFreeStanding.protected MetalScrollButtonThe increase button.protected booleanThe value of the propertyJScrollBar.isFreeStanding.protected intThe width of the scroll bar.Fields inherited from class BasicScrollBarUI
buttonListener, decrButton, DECREASE_HIGHLIGHT, decrGap, incrButton, INCREASE_HIGHLIGHT, incrGap, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollListener, scrollTimer, thumbDarkShadowColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRectFields inherited from interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidConfigures the scroll bar colors.protected JButtoncreateDecreaseButton(int orientation) Returns the view that represents the decrease view.protected JButtoncreateIncreaseButton(int orientation) Returns the view that represents the increase view.protected PropertyChangeListenerCreates a property change listener.static ComponentUIConstructs a newMetalScrollBarUIinstance.protected DimensionReturns the smallest acceptable size for the thumb.A vertical scrollbar's preferred width is the maximum of preferred widths of the (nonnull) increment/decrement buttons, and the minimum width of the thumb.protected voidInstalls the defaults.protected voidInstalls the listeners.protected voidpaintThumb(Graphics g, JComponent c, Rectangle thumbBounds) Paints the thumb.protected voidpaintTrack(Graphics g, JComponent c, Rectangle trackBounds) Paints the track.protected voidsetThumbBounds(int x, int y, int width, int height) This is overridden only to increase the invalid area.Methods inherited from class BasicScrollBarUI
addLayoutComponent, createArrowButtonListener, createModelListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installComponents, installKeyboardActions, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paint, paintDecreaseHighlight, paintIncreaseHighlight, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbRollover, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUIMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, update
-
Field Details
-
increaseButton
The increase button. -
decreaseButton
The decrease button. -
scrollBarWidth
protected int scrollBarWidthThe width of the scroll bar. -
FREE_STANDING_PROP
-
isFreeStanding
protected boolean isFreeStandingThe value of the propertyJScrollBar.isFreeStanding.
-
-
Constructor Details
-
MetalScrollBarUI
public MetalScrollBarUI()Constructs aMetalScrollBarUI.
-
-
Method Details
-
createUI
Constructs a newMetalScrollBarUIinstance.- Parameters:
c- a component- Returns:
- a new
MetalScrollBarUIinstance
-
installDefaults
protected void installDefaults()Description copied from class:BasicScrollBarUIInstalls the defaults.- Overrides:
installDefaultsin classBasicScrollBarUI
-
installListeners
protected void installListeners()Description copied from class:BasicScrollBarUIInstalls the listeners.- Overrides:
installListenersin classBasicScrollBarUI
-
createPropertyChangeListener
Description copied from class:BasicScrollBarUICreates a property change listener.- Overrides:
createPropertyChangeListenerin classBasicScrollBarUI- Returns:
- a property change listener
-
configureScrollBarColors
protected void configureScrollBarColors()Description copied from class:BasicScrollBarUIConfigures the scroll bar colors.- Overrides:
configureScrollBarColorsin classBasicScrollBarUI
-
getPreferredSize
Description copied from class:BasicScrollBarUIA vertical scrollbar's preferred width is the maximum of preferred widths of the (nonnull) 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
preferredSizeis only computed once, subsequent calls to this method just return a cached size.- Overrides:
getPreferredSizein classBasicScrollBarUI- Parameters:
c- theJScrollBarthat's delegating this method to us- Returns:
- the preferred size of a Basic JScrollBar
- See Also:
-
createDecreaseButton
Returns the view that represents the decrease view.- Overrides:
createDecreaseButtonin classBasicScrollBarUI- Parameters:
orientation- the orientation- Returns:
- a decrease button
-
createIncreaseButton
Returns the view that represents the increase view.- Overrides:
createIncreaseButtonin classBasicScrollBarUI- Parameters:
orientation- the orientation- Returns:
- an increase button
-
paintTrack
Description copied from class:BasicScrollBarUIPaints the track.- Overrides:
paintTrackin classBasicScrollBarUI- Parameters:
g- the graphicsc- the componenttrackBounds- the track bounds
-
paintThumb
Description copied from class:BasicScrollBarUIPaints the thumb.- Overrides:
paintThumbin classBasicScrollBarUI- Parameters:
g- the graphicsc- the componentthumbBounds- the thumb bounds
-
getMinimumThumbSize
Description copied from class:BasicScrollBarUIReturns 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:
getMinimumThumbSizein classBasicScrollBarUI- Returns:
- The smallest acceptable size for the thumb.
- See Also:
-
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:
setThumbBoundsin classBasicScrollBarUI- Parameters:
x- set the x location of the thumby- set the y location of the thumbwidth- set the width of the thumbheight- set the height of the thumb- See Also:
-