APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.plaf.synth

public Class SynthScrollBarUI

extends BasicScrollBarUI
implements PropertyChangeListener, SynthUI
Class Inheritance
All Implemented Interfaces
javax.swing.plaf.synth.SynthUI, javax.swing.plaf.synth.SynthConstants, java.beans.PropertyChangeListener, java.util.EventListener
Imports
java.awt.*, java.beans.*, javax.swing.*, javax.swing.plaf.*, javax.swing.plaf.basic.*

Provides the Synth L&F UI delegate for javax.swing.JScrollBar.
Author
Scott Violet
Since
1.7

Field Summary

Modifier and TypeField and Description
private SynthStyle
private SynthStyle
private SynthStyle
private boolean
Inherited from javax.swing.plaf.basic.BasicScrollBarUI:
buttonListenerdecrButtonDECREASE_HIGHLIGHTdecrGapincrButtonINCREASE_HIGHLIGHTincrGapisDraggingmaximumThumbSizeminimumThumbSizemodelListenerNO_HIGHLIGHTpropertyChangeListenerscrollbarscrollBarWidthscrollListenerscrollTimerthumbColorthumbDarkShadowColorthumbHighlightColorthumbLightShadowColorthumbRecttrackColortrackHighlighttrackHighlightColortrackListenertrackRect

Constructor Summary

AccessConstructor and Description
public
SynthScrollBarUI()

Constructs a SynthScrollBarUI.

Method Summary

Modifier and TypeMethod and Description
protected void
protected JButton
createDecreaseButton(int orientation)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.createDecreaseButton.

Creates a decrease button.

protected JButton
createIncreaseButton(int orientation)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.createIncreaseButton.

Creates an increase button.

public static ComponentUI

Returns:

a UI
createUI
(JComponent
a component
c
)

Hides javax.swing.plaf.basic.BasicScrollBarUI.createUI.

Returns a UI.

private int
public SynthContext
getContext(JComponent c)

Implements javax.swing.plaf.synth.SynthUI.getContext.

Returns the Context for the specified component.

private SynthContext
getContext(JComponent c, int state)

private SynthContext
private SynthContext
getContext(JComponent c, Region region, int state)

protected Dimension
getMinimumThumbSize()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getMinimumThumbSize.

Returns the smallest acceptable size for the thumb.

public Dimension

Returns:

the preferred size of a Basic JScrollBar
getPreferredSize
(JComponent
the JScrollBar that's delegating this method to us
c
)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getPreferredSize.

A vertical scrollbar's preferred width is the maximum of preferred widths of the (non null) increment/decrement buttons, and the minimum width of the thumb.

public boolean
getSupportsAbsolutePositioning()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getSupportsAbsolutePositioning.

Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button).

protected void
protected void
public void
paint(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.paint.

Paints the specified component according to the Look and Feel.

protected void
paint(SynthContext
context for the component being painted
context
,
Graphics
the Graphics object used for painting
g
)

Paints the specified component.

public void
paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthUI.paintBorder.

Paints the border.

protected void
paintThumb(SynthContext
context for the component being painted
context
,
Graphics
Graphics object used for painting
g
,
Rectangle
bounding box for the thumb
thumbBounds
)

Paints the scrollbar thumb.

protected void
paintTrack(SynthContext
context for the component being painted
context
,
Graphics
Graphics object used for painting
g
,
Rectangle
bounding box for the track
trackBounds
)

Paints the scrollbar track.

public void
propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

protected void
setThumbRollover(boolean active)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.setThumbRollover.

Sets whether or not the mouse is currently over the thumb.

protected void
protected void
public void
update(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.ComponentUI.update.

Notifies this UI delegate to repaint the specified component.

private void
private void
Inherited from javax.swing.plaf.basic.BasicScrollBarUI:
addLayoutComponentcreateArrowButtonListenercreateModelListenercreatePropertyChangeListenercreateScrollListenercreateTrackListenergetMaximumSizegetMaximumThumbSizegetThumbBoundsgetTrackBoundsinstallComponentsinstallKeyboardActionsinstallUIisThumbRolloverlayoutContainerlayoutHScrollbarlayoutVScrollbarminimumLayoutSizepaintDecreaseHighlightpaintIncreaseHighlightpaintThumbpaintTrackpreferredLayoutSizeremoveLayoutComponentscrollByBlockscrollByUnitsetThumbBoundsuninstallComponentsuninstallKeyboardActionsuninstallUI

Field Detail

styleback to summary
private SynthStyle style
thumbStyleback to summary
private SynthStyle thumbStyle
trackStyleback to summary
private SynthStyle trackStyle
validMinimumThumbSizeback to summary
private boolean validMinimumThumbSize

Constructor Detail

SynthScrollBarUIback to summary
public SynthScrollBarUI()

Constructs a SynthScrollBarUI.

Method Detail

configureScrollBarColorsback to summary
protected void configureScrollBarColors()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.configureScrollBarColors.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.configureScrollBarColors.

Configures the scroll bar colors.

Annotations
@Override
createDecreaseButtonback to summary
protected JButton createDecreaseButton(int orientation)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.createDecreaseButton.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.createDecreaseButton.

Creates a decrease button.

Annotations
@Override
createIncreaseButtonback to summary
protected JButton createIncreaseButton(int orientation)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.createIncreaseButton.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.createIncreaseButton.

Creates an increase button.

Annotations
@Override
createUIback to summary
public static ComponentUI createUI(JComponent c)

Hides javax.swing.plaf.basic.BasicScrollBarUI.createUI.

Returns a UI.

Parameters
c:JComponent

a component

Returns:ComponentUI

a UI

getComponentStateback to summary
private int getComponentState(JComponent c, Region region)
getContextback to summary
public SynthContext getContext(JComponent c)

Implements javax.swing.plaf.synth.SynthUI.getContext.

Doc from javax.swing.plaf.synth.SynthUI.getContext.

Returns the Context for the specified component.

Annotations
@Override
getContextback to summary
private SynthContext getContext(JComponent c, int state)
getContextback to summary
private SynthContext getContext(JComponent c, Region region)
getContextback to summary
private SynthContext getContext(JComponent c, Region region, int state)
getMinimumThumbSizeback to summary
protected Dimension getMinimumThumbSize()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getMinimumThumbSize.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.getMinimumThumbSize.

Returns 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.

Annotations
@Override
getPreferredSizeback to summary
public Dimension getPreferredSize(JComponent c)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getPreferredSize.

A vertical scrollbar's preferred width is the maximum of preferred widths of the (non null) 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.

Parameters
c:JComponent

the JScrollBar that's delegating this method to us

Returns:Dimension

the preferred size of a Basic JScrollBar

Annotations
@Override
See Also
getMaximumSize, getMinimumSize
getSupportsAbsolutePositioningback to summary
public boolean getSupportsAbsolutePositioning()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.getSupportsAbsolutePositioning.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.getSupportsAbsolutePositioning.

Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button).

Annotations
@Override
installDefaultsback to summary
protected void installDefaults()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.installDefaults.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.installDefaults.

Installs the defaults.

Annotations
@Override
installListenersback to summary
protected void installListeners()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.installListeners.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.installListeners.

Installs the listeners.

Annotations
@Override
paintback to summary
public void paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.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.

Parameters
g:Graphics

the Graphics object used for painting

c:JComponent

the component being painted

Annotations
@Override
See Also
paint(SynthContext, Graphics)
paintback to summary
protected void paint(SynthContext context, Graphics g)

Paints the specified component.

Parameters
context:SynthContext

context for the component being painted

g:Graphics

the Graphics object used for painting

See Also
update(Graphics, JComponent)
paintBorderback to summary
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthUI.paintBorder.

Doc from javax.swing.plaf.synth.SynthUI.paintBorder.

Paints the border.

Annotations
@Override
paintThumbback to summary
protected void paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)

Paints the scrollbar thumb.

Parameters
context:SynthContext

context for the component being painted

g:Graphics

Graphics object used for painting

thumbBounds:Rectangle

bounding box for the thumb

paintTrackback to summary
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds)

Paints the scrollbar track.

Parameters
context:SynthContext

context for the component being painted

g:Graphics

Graphics object used for painting

trackBounds:Rectangle

bounding box for the track

propertyChangeback to summary
public void propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

setThumbRolloverback to summary
protected void setThumbRollover(boolean active)

Overrides javax.swing.plaf.basic.BasicScrollBarUI.setThumbRollover.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.setThumbRollover.

Sets whether or not the mouse is currently over the thumb.

Annotations
@Override
uninstallDefaultsback to summary
protected void uninstallDefaults()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.uninstallDefaults.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.uninstallDefaults.

Uninstalls the defaults.

Annotations
@Override
uninstallListenersback to summary
protected void uninstallListeners()

Overrides javax.swing.plaf.basic.BasicScrollBarUI.uninstallListeners.

Doc from javax.swing.plaf.basic.BasicScrollBarUI.uninstallListeners.

Uninstall the listeners.

Annotations
@Override
updateback to summary
public void update(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.update.

Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls the paint(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.

Parameters
g:Graphics

the Graphics object used for painting

c:JComponent

the component being painted

Annotations
@Override
See Also
paint(SynthContext, Graphics)
updateButtonDirectionsback to summary
private void updateButtonDirections()

Hides javax.swing.plaf.basic.BasicScrollBarUI.updateButtonDirections.

updateStyleback to summary
private void updateStyle(JScrollBar c)