javax.swing.plaf.metal
Class MetalScrollBarUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended byjavax.swing.plaf.ScrollBarUI
          extended byjavax.swing.plaf.basic.BasicScrollBarUI
              extended byjavax.swing.plaf.metal.MetalScrollBarUI
All Implemented Interfaces:
LayoutManager, SwingConstants

public class MetalScrollBarUI
extends BasicScrollBarUI

Implementation of ScrollBarUI for the Metal Look and Feel

Author:
Tom Santos, Steve Wilson

Nested Class Summary
(package private)  class MetalScrollBarUI.ScrollBarListener
           
 
Nested classes inherited from class javax.swing.plaf.basic.BasicScrollBarUI
BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener
 
Field Summary
protected  MetalBumps bumps
           
private static Color darkShadowColor
           
protected  MetalScrollButton decreaseButton
           
static String FREE_STANDING_PROP
           
private static Color highlightColor
           
protected  MetalScrollButton increaseButton
           
protected  boolean isFreeStanding
           
protected  int scrollBarWidth
           
private static Color shadowColor
           
private static Color thumbColor
           
private static Color thumbHighlightColor
           
private static Color thumbShadow
           
 
Fields inherited from class javax.swing.plaf.basic.BasicScrollBarUI
buttonListener, decrButton, DECREASE_HIGHLIGHT, incrButton, INCREASE_HIGHLIGHT, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollListener, scrollTimer, thumbDarkShadowColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
MetalScrollBarUI()
           
 
Method Summary
protected  void configureScrollBarColors()
           
protected  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.
protected  java.beans.PropertyChangeListener createPropertyChangeListener()
           
static ComponentUI createUI(JComponent c)
          Returns an instance of the UI delegate for the specified component.
protected  Dimension getMinimumThumbSize()
          Return the smallest acceptable size for the thumb.
 Dimension getPreferredSize(JComponent c)
          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.
protected  void installDefaults()
           
protected  void installListeners()
           
protected  void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
           
protected  void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
           
protected  void setThumbBounds(int x, int y, int width, int height)
          This is overridden only to increase the invalid area.
 
Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI
addLayoutComponent, createArrowButtonListener, createModelListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getMinimumSize, getThumbBounds, getTrackBounds, installComponents, installKeyboardActions, installUI, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paint, paintDecreaseHighlight, paintIncreaseHighlight, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shadowColor

private static Color shadowColor

highlightColor

private static Color highlightColor

darkShadowColor

private static Color darkShadowColor

thumbColor

private static Color thumbColor

thumbShadow

private static Color thumbShadow

thumbHighlightColor

private static Color thumbHighlightColor

bumps

protected MetalBumps bumps

increaseButton

protected MetalScrollButton increaseButton

decreaseButton

protected MetalScrollButton decreaseButton

scrollBarWidth

protected int scrollBarWidth

FREE_STANDING_PROP

public static final String FREE_STANDING_PROP
See Also:
Constant Field Values

isFreeStanding

protected boolean isFreeStanding
Constructor Detail

MetalScrollBarUI

public MetalScrollBarUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Description copied from class: ComponentUI
Returns an instance of the UI delegate for the specified component. Each subclass must provide its own static createUI method that returns an instance of that UI delegate subclass. If the UI delegate subclass is stateless, it may return an instance that is shared by multiple components. If the UI delegate is stateful, then it should return a new instance per component. The default implementation of this method throws an error, as it should never be invoked.


installDefaults

protected void installDefaults()
Overrides:
installDefaults in class BasicScrollBarUI

installListeners

protected void installListeners()
Overrides:
installListeners in class BasicScrollBarUI

createPropertyChangeListener

protected java.beans.PropertyChangeListener createPropertyChangeListener()
Overrides:
createPropertyChangeListener in class BasicScrollBarUI

configureScrollBarColors

protected void configureScrollBarColors()
Overrides:
configureScrollBarColors in class BasicScrollBarUI

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Description copied from class: BasicScrollBarUI
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.

Overrides:
getPreferredSize in class BasicScrollBarUI
Parameters:
c - the JScrollBar that's delegating this method to us
Returns:
the preferred size of a Basic JScrollBar
See Also:
BasicScrollBarUI.getMaximumSize(javax.swing.JComponent), BasicScrollBarUI.getMinimumSize(javax.swing.JComponent)

createDecreaseButton

protected JButton createDecreaseButton(int orientation)
Returns the view that represents the decrease view.

Overrides:
createDecreaseButton in class BasicScrollBarUI

createIncreaseButton

protected JButton createIncreaseButton(int orientation)
Returns the view that represents the increase view.

Overrides:
createIncreaseButton in class BasicScrollBarUI

paintTrack

protected void paintTrack(Graphics g,
                          JComponent c,
                          Rectangle trackBounds)
Overrides:
paintTrack in class BasicScrollBarUI

paintThumb

protected void paintThumb(Graphics g,
                          JComponent c,
                          Rectangle thumbBounds)
Overrides:
paintThumb in class BasicScrollBarUI

getMinimumThumbSize

protected Dimension getMinimumThumbSize()
Description copied from class: BasicScrollBarUI
Return 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.

Overrides:
getMinimumThumbSize in class BasicScrollBarUI
Returns:
The smallest acceptable size for the thumb.
See Also:
BasicScrollBarUI.getMaximumThumbSize()

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 class BasicScrollBarUI
See Also:
BasicScrollBarUI.getThumbBounds()