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.TrackListener
Modifier and TypeClassDescriptionprotected class
Listener for cursor keys.protected class
A listener to listen for model changes.class
Property change handlerprotected class
Listener for scrolling events initiated in theScrollPane
.protected class
Track mouse drags. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MetalScrollButton
The decrease button.static final String
The propertyJScrollBar.isFreeStanding
.protected MetalScrollButton
The increase button.protected boolean
The value of the propertyJScrollBar.isFreeStanding
.protected int
The 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, trackRect
Modifier and TypeFieldDescriptionprotected BasicScrollBarUI.ArrowButtonListener
Button listenerprotected JButton
Decrement buttonprotected static final int
Decrease highlightprotected int
Distance between the decrement button and the track.protected JButton
Increment buttonprotected static final int
Increase highlightprotected int
Distance between the increment button and the track.protected boolean
Draggingprotected Dimension
Maximum thumb sizeprotected Dimension
Minimum thumb sizeprotected BasicScrollBarUI.ModelListener
Model listenerprotected static final int
No highlightprotected PropertyChangeListener
Property change listenerprotected JScrollBar
Scrollbarprotected BasicScrollBarUI.ScrollListener
Scroll listenerprotected Timer
Scroll timerprotected Color
Thumb dark shadow colorprotected Color
Thumb light shadow colorprotected Rectangle
Thumb rectangleprotected Color
Track colorprotected int
Track highlightprotected Color
Track highlight colorprotected BasicScrollBarUI.TrackListener
Track listenerprotected Rectangle
Track 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, WEST
Modifier and TypeFieldDescriptionstatic final int
Box-orientation constant used to specify the bottom of a box.static final int
The central position in an area.static final int
Compass-direction east (right).static final int
Horizontal orientation.static final int
Identifies the leading edge of text for use with left-to-right and right-to-left languages.static final int
Box-orientation constant used to specify the left side of a box.static final int
Identifies the next direction in a sequence.static final int
Compass-direction North (up).static final int
Compass-direction north-east (upper right).static final int
Compass-direction north west (upper left).static final int
Identifies the previous direction in a sequence.static final int
Box-orientation constant used to specify the right side of a box.static final int
Compass-direction south (down).static final int
Compass-direction south-east (lower right).static final int
Compass-direction south-west (lower left).static final int
Box-orientation constant used to specify the top of a box.static final int
Identifies the trailing edge of text for use with left-to-right and right-to-left languages.static final int
Vertical orientation.static final int
Compass-direction west (left). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.static ComponentUI
Constructs a newMetalScrollBarUI
instance.protected void
setThumbBounds
(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, uninstallUI
Modifier and TypeMethodDescriptionvoid
addLayoutComponent
(String name, Component child) If the layout manager uses a per-component string, adds the componentcomp
to the layout, associating it with the string specified byname
.protected void
Configures the scroll bar colors.protected BasicScrollBarUI.ArrowButtonListener
Creates an arrow button listener.protected BasicScrollBarUI.ModelListener
Creates a model listener.protected PropertyChangeListener
Creates a property change listener.protected BasicScrollBarUI.ScrollListener
Creates a scroll listener.protected BasicScrollBarUI.TrackListener
Creates a track listener.Returns the specified component's maximum size appropriate for the look and feel.protected Dimension
Returns the largest acceptable size for the thumb.protected Dimension
Returns 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.boolean
Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button).protected Rectangle
Return the current size/location of the thumb.protected Rectangle
Returns the current bounds of the track, i.e. the space in between the increment and decrement buttons, less the insets.protected void
Installs the components.protected void
Installs the defaults.protected void
Installs the keyboard actions.protected void
Installs the listeners.void
Installs the UI.boolean
Returns true if the mouse is currently over the thumb.void
layoutContainer
(Container scrollbarContainer) Lays out the specified container.protected void
Lays out a horizontal scroll bar.protected void
Lays out a vertical scroll bar.minimumLayoutSize
(Container scrollbarContainer) Calculates the minimum size dimensions for the specified container, given the components it contains.protected void
Paints the decrease highlight.protected void
Paints the increase highlight.protected void
paintThumb
(Graphics g, JComponent c, Rectangle thumbBounds) Paints the thumb.protected void
paintTrack
(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.void
removeLayoutComponent
(Component child) Removes the specified component from the layout.protected void
scrollByBlock
(int direction) Scrolls by block.protected void
scrollByUnit
(int direction) Scrolls by unit.protected void
setThumbRollover
(boolean active) Sets whether or not the mouse is currently over the thumb.protected void
Uninstalls the components.protected void
Uninstalls the defaults.protected void
Uninstalls the keyboard actions.protected void
Uninstall the listeners.void
Uninstalls the UI.Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, paint, update
Modifier and TypeMethodDescriptionboolean
contains
(JComponent c, int x, int y) Returnstrue
if 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 thei
thAccessible
child of the object.int
Returns the number of accessible children in the object.int
getBaseline
(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.void
paint
(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.void
update
(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, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
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
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(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 void
wait
(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 newMetalScrollBarUI
instance.- Parameters:
c
- a component- Returns:
- a new
MetalScrollBarUI
instance
-
createDecreaseButton
Returns the view that represents the decrease view.- Overrides:
createDecreaseButton
in classBasicScrollBarUI
- Parameters:
orientation
- the orientation- Returns:
- a decrease button
-
createIncreaseButton
Returns the view that represents the increase view.- Overrides:
createIncreaseButton
in 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:
setThumbBounds
in 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:
-