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.TrackListenerModifier and TypeClassDescriptionprotected classListener for cursor keys.protected classA listener to listen for model changes.classProperty change handlerprotected classListener for scrolling events initiated in theScrollPane.protected classTrack mouse drags. -
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, trackRectModifier and TypeFieldDescriptionprotected BasicScrollBarUI.ArrowButtonListenerButton listenerprotected JButtonDecrement buttonprotected static final intDecrease highlightprotected intDistance between the decrement button and the track.protected JButtonIncrement buttonprotected static final intIncrease highlightprotected intDistance between the increment button and the track.protected booleanDraggingprotected DimensionMaximum thumb sizeprotected DimensionMinimum thumb sizeprotected BasicScrollBarUI.ModelListenerModel listenerprotected static final intNo highlightprotected PropertyChangeListenerProperty change listenerprotected JScrollBarScrollbarprotected BasicScrollBarUI.ScrollListenerScroll listenerprotected TimerScroll timerprotected ColorThumb dark shadow colorprotected ColorThumb light shadow colorprotected RectangleThumb rectangleprotected ColorTrack colorprotected intTrack highlightprotected ColorTrack highlight colorprotected BasicScrollBarUI.TrackListenerTrack listenerprotected RectangleTrack rectangleFields 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, WESTModifier and TypeFieldDescriptionstatic final intBox-orientation constant used to specify the bottom of a box.static final intThe central position in an area.static final intCompass-direction east (right).static final intHorizontal orientation.static final intIdentifies the leading edge of text for use with left-to-right and right-to-left languages.static final intBox-orientation constant used to specify the left side of a box.static final intIdentifies the next direction in a sequence.static final intCompass-direction North (up).static final intCompass-direction north-east (upper right).static final intCompass-direction north west (upper left).static final intIdentifies the previous direction in a sequence.static final intBox-orientation constant used to specify the right side of a box.static final intCompass-direction south (down).static final intCompass-direction south-east (lower right).static final intCompass-direction south-west (lower left).static final intBox-orientation constant used to specify the top of a box.static final intIdentifies the trailing edge of text for use with left-to-right and right-to-left languages.static final intVertical orientation.static final intCompass-direction west (left). -
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, uninstallUIModifier and TypeMethodDescriptionvoidaddLayoutComponent(String name, Component child) If the layout manager uses a per-component string, adds the componentcompto the layout, associating it with the string specified byname.protected BasicScrollBarUI.ArrowButtonListenerCreates an arrow button listener.protected BasicScrollBarUI.ModelListenerCreates a model listener.protected BasicScrollBarUI.ScrollListenerCreates a scroll listener.protected BasicScrollBarUI.TrackListenerCreates a track listener.Returns the specified component's maximum size appropriate for the look and feel.protected DimensionReturns the largest acceptable size for the thumb.booleanIndicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button).protected RectangleReturn the current size/location of the thumb.protected RectangleReturns the current bounds of the track, i.e. the space in between the increment and decrement buttons, less the insets.protected voidInstalls the components.protected voidInstalls the keyboard actions.voidInstalls the UI.booleanReturns true if the mouse is currently over the thumb.voidlayoutContainer(Container scrollbarContainer) Lays out the specified container.protected voidLays out a horizontal scroll bar.protected voidLays out a vertical scroll bar.minimumLayoutSize(Container scrollbarContainer) Calculates the minimum size dimensions for the specified container, given the components it contains.voidpaint(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.protected voidPaints the decrease highlight.protected voidPaints the increase highlight.preferredLayoutSize(Container scrollbarContainer) Calculates the preferred size dimensions for the specified container, given the components it contains.voidremoveLayoutComponent(Component child) Removes the specified component from the layout.protected voidscrollByBlock(int direction) Scrolls by block.protected voidscrollByUnit(int direction) Scrolls by unit.protected voidsetThumbRollover(boolean active) Sets whether or not the mouse is currently over the thumb.protected voidUninstalls the components.protected voidUninstalls the defaults.protected voidUninstalls the keyboard actions.protected voidUninstall the listeners.voidUninstalls the UI.Methods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, updateModifier and TypeMethodDescriptionbooleancontains(JComponent c, int x, int y) Returnstrueif the specified x,y location is contained within the look and feel's defined shape of the specified component.getAccessibleChild(JComponent c, int i) Returns theithAccessiblechild of the object.intReturns the number of accessible children in the object.intgetBaseline(JComponent c, int width, int height) Returns the baseline.Returns an enum indicating how the baseline of the component changes as the size changes.Returns the specified component's minimum size appropriate for the look and feel.voidupdate(Graphics g, JComponent c) Notifies this UI delegate that it is time to paint the specified component.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
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:
-