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 declared in 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 declared in 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 declared in 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 JButtoncreateDecreaseButton(int orientation) Returns the view that represents the decrease view.protected JButtoncreateIncreaseButton(int orientation) Returns the view that represents the increase view.static ComponentUIConstructs a newMetalScrollBarUIinstance.protected voidsetThumbBounds(int x, int y, int width, int height) This is overridden only to increase the invalid area.Methods declared in class BasicScrollBarUI
addLayoutComponent, configureScrollBarColors, createArrowButtonListener, createModelListener, createPropertyChangeListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getPreferredSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, paintThumb, paintTrack, 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 voidConfigures the scroll bar colors.protected BasicScrollBarUI.ArrowButtonListenerCreates an arrow button listener.protected BasicScrollBarUI.ModelListenerCreates a model listener.protected PropertyChangeListenerCreates a property change 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.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.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 defaults.protected voidInstalls the keyboard actions.protected voidInstalls the listeners.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.protected voidPaints the decrease highlight.protected voidPaints the increase highlight.protected voidpaintThumb(Graphics g, JComponent c, Rectangle thumbBounds) Paints the thumb.protected voidpaintTrack(Graphics g, JComponent c, Rectangle trackBounds) Paints the track.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 declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, paint, 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.voidpaint(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.voidupdate(Graphics g, JComponent c) Notifies this UI delegate that it is time to paint the specified component.Methods declared in 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
-
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
-
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:
-