|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.ScrollBarUI
javax.swing.plaf.basic.BasicScrollBarUI
javax.swing.plaf.metal.MetalScrollBarUI
public class MetalScrollBarUI
A UI delegate for the JScrollBar component.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicScrollBarUI |
|---|
BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener |
| Field Summary | |
|---|---|
protected MetalScrollButton |
decreaseButton
The button that decreases the value in the scroll bar. |
static String |
FREE_STANDING_PROP
The name for the 'free standing' property. |
protected MetalScrollButton |
increaseButton
The button that increases the value in the scroll bar. |
protected boolean |
isFreeStanding
A flag that indicates whether the scroll bar is "free standing", which means it has complete borders and can be used anywhere in the UI. |
protected int |
scrollBarWidth
The scroll bar width. |
| 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, thumbColor, thumbDarkShadowColor, thumbHighlightColor, 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()
Constructs a new instance of MetalScrollBarUI, with no
specific initialisation. |
|
| Method Summary | |
|---|---|
protected JButton |
createDecreaseButton(int orientation)
Creates a new button to use as the control at the lower end of the JScrollBar. |
protected JButton |
createIncreaseButton(int orientation)
Creates a new button to use as the control at the upper end of the JScrollBar. |
protected PropertyChangeListener |
createPropertyChangeListener()
Creates a property change listener for the delegate to use. |
static ComponentUI |
createUI(JComponent component)
Returns a new instance of MetalScrollBarUI. |
protected Dimension |
getMinimumThumbSize()
Returns the minimum thumb size. |
Dimension |
getPreferredSize(JComponent c)
Returns the preferredSize for the specified scroll bar. |
protected void |
installDefaults()
Installs the defaults. |
protected void |
paintThumb(Graphics g,
JComponent c,
Rectangle thumbBounds)
Paints the slider button of the ScrollBar. |
protected void |
paintTrack(Graphics g,
JComponent c,
Rectangle trackBounds)
Paints the track for the scrollbar. |
| 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 |
|---|
public static final String FREE_STANDING_PROP
protected MetalScrollButton increaseButton
protected MetalScrollButton decreaseButton
protected int scrollBarWidth
protected boolean isFreeStanding
| Constructor Detail |
|---|
public MetalScrollBarUI()
MetalScrollBarUI, with no
specific initialisation.
| Method Detail |
|---|
public static ComponentUI createUI(JComponent component)
MetalScrollBarUI.
component - the component for which we return an UI instance
protected void installDefaults()
installDefaults in class BasicScrollBarUIprotected PropertyChangeListener createPropertyChangeListener()
MetalLookAndFeel that can handle the
JScrollBar.isFreeStanding property.
createPropertyChangeListener in class BasicScrollBarUIprotected JButton createDecreaseButton(int orientation)
JScrollBar. This method assigns the new button (an instance of
MetalScrollButton to the decreaseButton field, and also
returns the button. The button width is determined by the
ScrollBar.width setting in the UI defaults.
createDecreaseButton in class BasicScrollBarUIorientation - the orientation of the button (SwingConstants.NORTH,
SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST).
protected JButton createIncreaseButton(int orientation)
JScrollBar. This method assigns the new button (an instance of
MetalScrollButton to the increaseButton field, and also
returns the button. The button width is determined by the
ScrollBar.width setting in the UI defaults.
createIncreaseButton in class BasicScrollBarUIorientation - the orientation of the button (SwingConstants.NORTH,
SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST).
protected void paintTrack(Graphics g,
JComponent c,
Rectangle trackBounds)
paintTrack in class BasicScrollBarUIg - the graphics device.c - the component.trackBounds - the track bounds.
protected void paintThumb(Graphics g,
JComponent c,
Rectangle thumbBounds)
paintThumb in class BasicScrollBarUIg - the Graphics context to usec - the JComponent on which we paintthumbBounds - the rectangle that is the slider buttonprotected Dimension getMinimumThumbSize()
17 x 17 pixels, whereas for a non free
standing scroll bar the minimum size is 15 x 15 pixels.
getMinimumThumbSize in class BasicScrollBarUIpublic Dimension getPreferredSize(JComponent c)
preferredSize for the specified scroll bar.
For a vertical scrollbar the height is the sum of the preferred heights
of the buttons plus 30. The width is fetched from the
UIManager property ScrollBar.width.
For horizontal scrollbars the width is the sum of the preferred widths
of the buttons plus 30. The height is fetched from the
UIManager property ScrollBar.height.
getPreferredSize in class BasicScrollBarUIc - the scrollbar for which to calculate the preferred size
preferredSize for the specified scroll bar
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||