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.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
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, 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 intHint as to what width (when vertical) or height (when horizontal) should be.protected BasicScrollBarUI.ScrollListenerScroll listenerprotected TimerScroll timerprotected ColorThumb colorprotected ColorThumb dark shadow colorprotected ColorThumb highlight 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).Fields declared in interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTEDModifier and TypeFieldDescriptionstatic final intIndicates the region is the default.static final intPrimary state indicating the region is not enabled.static final intPrimary state indicating the component is enabled.static final intIndicates the region has focus.static final intPrimary state indicating the mouse is over the region.static final intPrimary state indicating the region is in a pressed state.static final intIndicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUIReturns 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.voidpaint(Graphics g, JComponent c) Paints the specified component according to the Look and Feel.protected voidpaint(SynthContext context, Graphics g) Paints the specified component.voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.protected voidpaintThumb(SynthContext context, Graphics g, Rectangle thumbBounds) Paints the scrollbar thumb.protected voidpaintTrack(SynthContext context, Graphics g, Rectangle trackBounds) Paints the scrollbar track.voidThis method gets called when a bound property is changed.voidupdate(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, 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 JButtoncreateDecreaseButton(int orientation) Creates a decrease button.protected JButtoncreateIncreaseButton(int orientation) Creates an increase button.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.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 voidsetThumbBounds(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 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, getMinimumSizeModifier 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.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.
-
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:
getContextin 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
paintmethod.- Overrides:
updatein classComponentUI- Parameters:
g- theGraphicsobject 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:
paintin classComponentUI- Parameters:
g- theGraphicsobject used for paintingc- the component being painted- See Also:
-
paint
Paints the specified component.- Parameters:
context- context for the component being paintedg- theGraphicsobject used for painting- See Also:
-
paintBorder
Paints the border.- Specified by:
paintBorderin interfaceSynthUI- Parameters:
context- a component contextg-Graphicsto 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-Graphicsobject used for paintingtrackBounds- bounding box for the track
-
paintThumb
Paints the scrollbar thumb.- Parameters:
context- context for the component being paintedg-Graphicsobject 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
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:
-
propertyChange
Description copied from interface:PropertyChangeListenerThis method gets called when a bound property is changed.- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
e- A PropertyChangeEvent object describing the event source and the property that has changed.
-