Class SynthScrollBarUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ScrollBarUI
javax.swing.plaf.basic.BasicScrollBarUI
javax.swing.plaf.synth.SynthScrollBarUI
- All Implemented Interfaces:
LayoutManager, PropertyChangeListener, EventListener, SynthConstants, SynthUI, SwingConstants
Provides the Synth L&F UI delegate for
JScrollBar
.- Since:
- 1.7
-
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
Fields declared in class BasicScrollBarUI
buttonListener, decrButton, DECREASE_HIGHLIGHT, decrGap, incrButton, INCREASE_HIGHLIGHT, incrGap, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollBarWidth, scrollListener, scrollTimer, thumbColor, thumbDarkShadowColor, thumbHighlightColor, 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 int
Hint as to what width (when vertical) or height (when horizontal) should be.protected BasicScrollBarUI.ScrollListener
Scroll listenerprotected Timer
Scroll timerprotected Color
Thumb colorprotected Color
Thumb dark shadow colorprotected Color
Thumb highlight 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).Fields declared in interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Modifier and TypeFieldDescriptionstatic final int
Indicates the region is the default.static final int
Primary state indicating the region is not enabled.static final int
Primary state indicating the component is enabled.static final int
Indicates the region has focus.static final int
Primary state indicating the mouse is over the region.static final int
Primary state indicating the region is in a pressed state.static final int
Indicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUI
Returns a UI.Returns the Context for the specified component.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.void
paint
(Graphics g, JComponent c) Paints the specified component according to the Look and Feel.protected void
paint
(SynthContext context, Graphics g) Paints the specified component.void
paintBorder
(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.protected void
paintThumb
(SynthContext context, Graphics g, Rectangle thumbBounds) Paints the scrollbar thumb.protected void
paintTrack
(SynthContext context, Graphics g, Rectangle trackBounds) Paints the scrollbar track.void
This method gets called when a bound property is changed.void
update
(Graphics g, JComponent c) Notifies this UI delegate to repaint the specified component.Methods declared in class BasicScrollBarUI
addLayoutComponent, configureScrollBarColors, createArrowButtonListener, createDecreaseButton, createIncreaseButton, createModelListener, createPropertyChangeListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getMinimumThumbSize, getSupportsAbsolutePositioning, getThumbBounds, getTrackBounds, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, paintThumb, paintTrack, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbBounds, 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 JButton
createDecreaseButton
(int orientation) Creates a decrease button.protected JButton
createIncreaseButton
(int orientation) Creates an increase button.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.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
setThumbBounds
(int x, int y, int width, int height) Set the bounds of the thumb and force a repaint that includes the old thumbBounds and the new one.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
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.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.
-
Constructor Details
-
SynthScrollBarUI
public SynthScrollBarUI()Constructs aSynthScrollBarUI
.
-
-
Method Details
-
createUI
Returns a UI.- Parameters:
c
- a component- Returns:
- a UI
-
getContext
Returns the Context for the specified component.- Specified by:
getContext
in interfaceSynthUI
- Parameters:
c
- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-
update
Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls thepaint(SynthContext,Graphics)
method.In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the
paint
method.- Overrides:
update
in classComponentUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
-
paint
Paints the specified component according to the Look and Feel.This method is not used by Synth Look and Feel. Painting is handled by the
paint(SynthContext,Graphics)
method.- Overrides:
paint
in classComponentUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
-
paint
Paints the specified component.- Parameters:
context
- context for the component being paintedg
- theGraphics
object used for painting- See Also:
-
paintBorder
Paints the border.- Specified by:
paintBorder
in interfaceSynthUI
- Parameters:
context
- a component contextg
-Graphics
to paint onx
- the X coordinatey
- the Y coordinatew
- width of the borderh
- height of the border
-
paintTrack
Paints the scrollbar track.- Parameters:
context
- context for the component being paintedg
-Graphics
object used for paintingtrackBounds
- bounding box for the track
-
paintThumb
Paints the scrollbar thumb.- Parameters:
context
- context for the component being paintedg
-Graphics
object used for paintingthumbBounds
- bounding box for the thumb
-
getPreferredSize
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. 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 classBasicScrollBarUI
- Parameters:
c
- theJScrollBar
that's delegating this method to us- Returns:
- the preferred size of a Basic JScrollBar
- See Also:
-
propertyChange
Description copied from interface:PropertyChangeListener
This method gets called when a bound property is changed.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
- A PropertyChangeEvent object describing the event source and the property that has changed.
-