public class

MetalScrollBarUI

extends BasicScrollBarUI
java.lang.Object
   ↳ javax.swing.plaf.ComponentUI
     ↳ javax.swing.plaf.ScrollBarUI
       ↳ javax.swing.plaf.basic.BasicScrollBarUI
         ↳ javax.swing.plaf.metal.MetalScrollBarUI

Class Overview

Implementation of ScrollBarUI for the Metal Look and Feel

Summary

Constants
String FREE_STANDING_PROP
[Expand]
Inherited Constants
From class javax.swing.plaf.basic.BasicScrollBarUI
From interface javax.swing.SwingConstants
Fields
protected MetalBumps bumps
protected MetalScrollButton decreaseButton
protected MetalScrollButton increaseButton
protected boolean isFreeStanding
protected int scrollBarWidth
[Expand]
Inherited Fields
From class javax.swing.plaf.basic.BasicScrollBarUI
Public Constructors
MetalScrollBarUI()
Public Methods
static ComponentUI createUI(JComponent c)
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 Methods
void configureScrollBarColors()
JButton createDecreaseButton(int orientation)
Returns the view that represents the decrease view.
JButton createIncreaseButton(int orientation)
Returns the view that represents the increase view.
PropertyChangeListener createPropertyChangeListener()
Dimension getMinimumThumbSize()
Return the smallest acceptable size for the thumb.
void installDefaults()
void installListeners()
void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
void setThumbBounds(int x, int y, int width, int height)
This is overridden only to increase the invalid area.
[Expand]
Inherited Methods
From class javax.swing.plaf.basic.BasicScrollBarUI
From class javax.swing.plaf.ComponentUI
From class java.lang.Object
From interface java.awt.LayoutManager

Constants

public static final String FREE_STANDING_PROP

Constant Value: "JScrollBar.isFreeStanding"

Fields

protected MetalBumps bumps

protected MetalScrollButton decreaseButton

protected MetalScrollButton increaseButton

protected boolean isFreeStanding

protected int scrollBarWidth

Public Constructors

public MetalScrollBarUI ()

Public Methods

public static ComponentUI createUI (JComponent c)

public 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. 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 the JScrollBar that's delegating this method to us
Returns
  • the preferred size of a Basic JScrollBar

Protected Methods

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 PropertyChangeListener createPropertyChangeListener ()

protected Dimension getMinimumThumbSize ()

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.

Returns
  • The smallest acceptable size for 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. This ensures that the "Shadow" below the thumb is invalidated