public class BasicScrollBarUI extends javax.swing.plaf.ScrollBarUI implements java.awt.LayoutManager, javax.swing.SwingConstants
| Modifier and Type | Class and Description |
|---|---|
protected class |
BasicScrollBarUI.ArrowButtonListener
A helper class that listens to the two JButtons on each end of the
JScrollBar.
|
protected class |
BasicScrollBarUI.ModelListener
A helper class that listens to the ScrollBar's model for ChangeEvents.
|
class |
BasicScrollBarUI.PropertyChangeHandler
A helper class that listens to the ScrollBar's properties.
|
protected class |
BasicScrollBarUI.ScrollListener
A helper class that listens for events from the timer that is used to
move the thumb.
|
protected class |
BasicScrollBarUI.TrackListener
Helper class that listens for movement on the track.
|
| Modifier and Type | Field and Description |
|---|---|
protected BasicScrollBarUI.ArrowButtonListener |
buttonListener
The listener that listens to the JButtons.
|
protected javax.swing.JButton |
decrButton
The JButton that decrements the scrollbar's value.
|
protected static int |
DECREASE_HIGHLIGHT
Indicates that the decrease highlight should be painted.
|
protected javax.swing.JButton |
incrButton
The JButton that increments the scrollbar's value.
|
protected static int |
INCREASE_HIGHLIGHT
Indicates that the increase highlight should be painted.
|
protected boolean |
isDragging
FIXME: Use this for something (presumably mouseDragged)
|
protected java.awt.Dimension |
maximumThumbSize
The dimensions of the maximum thumb size.
|
protected java.awt.Dimension |
minimumThumbSize
The dimensions of the minimum thumb size.
|
protected BasicScrollBarUI.ModelListener |
modelListener
The listener that listens to the model.
|
protected static int |
NO_HIGHLIGHT
Indicates that no highlight should be painted.
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
The listener that listens to the scrollbar for property changes.
|
protected javax.swing.JScrollBar |
scrollbar
The scrollbar this UI is acting for.
|
protected BasicScrollBarUI.ScrollListener |
scrollListener
The listener that listens to the timer.
|
protected javax.swing.Timer |
scrollTimer
The timer used to move the thumb when the mouse is held.
|
protected java.awt.Color |
thumbColor
The color of the thumb.
|
protected java.awt.Color |
thumbDarkShadowColor
The outer shadow of the thumb.
|
protected java.awt.Color |
thumbHighlightColor
The top and left edge color for the thumb.
|
protected java.awt.Color |
thumbLightShadowColor
The outer light shadow for the thumb.
|
protected java.awt.Rectangle |
thumbRect
The size and position of the thumb.
|
protected java.awt.Color |
trackColor
The color of the track.
|
protected int |
trackHighlight
The current highlight status.
|
protected java.awt.Color |
trackHighlightColor
The color that is used when the mouse press occurs in the track.
|
protected BasicScrollBarUI.TrackListener |
trackListener
The listener that listens for MouseEvents on the track.
|
protected java.awt.Rectangle |
trackRect
The size and position of the track.
|
| Constructor and Description |
|---|
BasicScrollBarUI() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component child)
This method adds a component to the layout.
|
protected void |
configureScrollBarColors()
This method configures the scrollbar's colors.
|
protected BasicScrollBarUI.ArrowButtonListener |
createArrowButtonListener()
This method creates an ArrowButtonListener.
|
protected javax.swing.JButton |
createDecreaseButton(int orientation)
This method creates a new JButton with the appropriate icon for the
orientation.
|
protected javax.swing.JButton |
createIncreaseButton(int orientation)
This method creates a new JButton with the appropriate icon for the
orientation.
|
protected BasicScrollBarUI.ModelListener |
createModelListener()
This method creates a new ModelListener.
|
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
This method creates a new PropertyChangeListener.
|
protected BasicScrollBarUI.ScrollListener |
createScrollListener()
This method creates a new ScrollListener.
|
protected BasicScrollBarUI.TrackListener |
createTrackListener()
This method creates a new TrackListener.
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
This method returns a new BasicScrollBarUI.
|
java.awt.Dimension |
getMaximumSize(javax.swing.JComponent c)
This method returns the maximum size for this JComponent.
|
protected java.awt.Dimension |
getMaximumThumbSize()
This method returns the maximum thumb size.
|
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c)
This method returns the minimum size for this JComponent.
|
protected java.awt.Dimension |
getMinimumThumbSize()
This method returns the minimum thumb size.
|
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent c)
This method returns a cached value of the preferredSize.
|
boolean |
getSupportsAbsolutePositioning()
Indicates whether the user can position the thumb with
a mouse click (i.e. middle button).
|
protected java.awt.Rectangle |
getThumbBounds()
This method returns the thumb's bounds based on the current value of the
scrollbar.
|
protected java.awt.Rectangle |
getTrackBounds()
This method calculates the bounds of the track.
|
protected void |
installComponents()
This method installs any addition Components that are a part of or
related to this scrollbar.
|
protected void |
installDefaults()
This method installs the defaults for the scrollbar specified by the
Basic Look and Feel.
|
protected void |
installKeyboardActions()
Installs the input map from the look and feel defaults, and a
corresponding action map.
|
protected void |
installListeners()
This method installs any listeners for the scrollbar.
|
void |
installUI(javax.swing.JComponent c)
This method installs the UI for the component.
|
boolean |
isThumbRollover()
Returns true if the mouse is over the thumb.
|
void |
layoutContainer(java.awt.Container scrollbarContainer)
This method lays out the scrollbar.
|
protected void |
layoutHScrollbar(javax.swing.JScrollBar sb)
This method lays out the scrollbar horizontally.
|
protected void |
layoutVScrollbar(javax.swing.JScrollBar sb)
This method lays out the scrollbar vertically.
|
java.awt.Dimension |
minimumLayoutSize(java.awt.Container scrollbarContainer)
This method returns the minimum size required for the layout.
|
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
This method is called when the component is painted.
|
protected void |
paintDecreaseHighlight(java.awt.Graphics g)
This method is called when repainting and the mouse is pressed in the
track.
|
protected void |
paintIncreaseHighlight(java.awt.Graphics g)
This method is called when repainting and the mouse is pressed in the
track.
|
protected void |
paintThumb(java.awt.Graphics g,
javax.swing.JComponent c,
java.awt.Rectangle thumbBounds)
This method paints the thumb.
|
protected void |
paintTrack(java.awt.Graphics g,
javax.swing.JComponent c,
java.awt.Rectangle trackBounds)
This method paints the track.
|
java.awt.Dimension |
preferredLayoutSize(java.awt.Container scrollbarContainer)
This method returns the preferred size for the layout.
|
void |
removeLayoutComponent(java.awt.Component child)
This method removes a child component from the layout.
|
protected void |
scrollByBlock(int direction)
The method scrolls the thumb by a block in the direction specified.
|
protected void |
scrollByUnit(int direction)
The method scrolls the thumb by a unit in the direction specified.
|
protected void |
setThumbBounds(int x,
int y,
int width,
int height)
This method sets the thumb's bounds.
|
protected void |
setThumbRollover(boolean active)
Set thumbRollover to active.
|
protected void |
uninstallComponents()
This method uninstalls any components that are a part of or related to
this scrollbar.
|
protected void |
uninstallDefaults()
This method uninstalls any defaults that this scrollbar acquired from the
Basic Look and Feel defaults.
|
protected void |
uninstallKeyboardActions()
Uninstalls the input map and action map installed by
installKeyboardActions(). |
protected void |
uninstallListeners()
This method uninstalls any listeners that were registered during install.
|
void |
uninstallUI(javax.swing.JComponent c)
This method uninstalls the UI.
|
protected BasicScrollBarUI.ArrowButtonListener buttonListener
protected BasicScrollBarUI.ModelListener modelListener
protected java.beans.PropertyChangeListener propertyChangeListener
protected BasicScrollBarUI.ScrollListener scrollListener
protected BasicScrollBarUI.TrackListener trackListener
protected javax.swing.JButton decrButton
protected javax.swing.JButton incrButton
protected java.awt.Dimension maximumThumbSize
protected java.awt.Dimension minimumThumbSize
protected java.awt.Color thumbColor
protected java.awt.Color thumbDarkShadowColor
protected java.awt.Color thumbHighlightColor
protected java.awt.Color thumbLightShadowColor
protected java.awt.Color trackHighlightColor
protected java.awt.Color trackColor
protected java.awt.Rectangle trackRect
protected java.awt.Rectangle thumbRect
protected static final int DECREASE_HIGHLIGHT
protected static final int INCREASE_HIGHLIGHT
protected static final int NO_HIGHLIGHT
protected int trackHighlight
protected boolean isDragging
protected javax.swing.Timer scrollTimer
protected javax.swing.JScrollBar scrollbar
public BasicScrollBarUI()
public void addLayoutComponent(java.lang.String name, java.awt.Component child)
addLayoutComponent in interface java.awt.LayoutManagername - The name to associate with the component that is added.child - The Component to add.protected void configureScrollBarColors()
protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
protected javax.swing.JButton createIncreaseButton(int orientation)
orientation - The orientation this JButton uses.protected javax.swing.JButton createDecreaseButton(int orientation)
orientation - The orientation this JButton uses.protected BasicScrollBarUI.ModelListener createModelListener()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected BasicScrollBarUI.ScrollListener createScrollListener()
protected BasicScrollBarUI.TrackListener createTrackListener()
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
c - The JComponent to create a UI for.public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
getMaximumSize in class javax.swing.plaf.ComponentUIc - The JComponent to measure the maximum size for.protected java.awt.Dimension getMaximumThumbSize()
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
getMinimumSize in class javax.swing.plaf.ComponentUIc - The JComponent to measure the minimum size for.protected java.awt.Dimension getMinimumThumbSize()
public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize in class javax.swing.plaf.ComponentUIc - The JComponent to measure.protected java.awt.Rectangle getThumbBounds()
protected java.awt.Rectangle getTrackBounds()
protected void installComponents()
protected void installDefaults()
protected void installKeyboardActions()
JScrollBar component has the focus, which is rare.protected void uninstallKeyboardActions()
installKeyboardActions().protected void installListeners()
public void installUI(javax.swing.JComponent c)
installUI in class javax.swing.plaf.ComponentUIc - The JComponent to install.ComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void layoutContainer(java.awt.Container scrollbarContainer)
layoutContainer in interface java.awt.LayoutManagerscrollbarContainer - The Container to layout.protected void layoutHScrollbar(javax.swing.JScrollBar sb)
sb - The JScrollBar to layout.protected void layoutVScrollbar(javax.swing.JScrollBar sb)
sb - The JScrollBar to layout.public java.awt.Dimension minimumLayoutSize(java.awt.Container scrollbarContainer)
minimumLayoutSize in interface java.awt.LayoutManagerscrollbarContainer - The Container that is laid out.LayoutManager.preferredLayoutSize(Container)public void paint(java.awt.Graphics g, javax.swing.JComponent c)
paint in class javax.swing.plaf.ComponentUIg - The Graphics object to paint with.c - The JComponent to paint.protected void paintDecreaseHighlight(java.awt.Graphics g)
g - The Graphics object to paint with.protected void paintIncreaseHighlight(java.awt.Graphics g)
g - The Graphics objet to paint with.protected void paintThumb(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle thumbBounds)
g - The Graphics object to paint with.c - The Component that is being painted.thumbBounds - The thumb bounds.protected void paintTrack(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle trackBounds)
g - The Graphics object to paint with.c - The JComponent being painted.trackBounds - The track's bounds.public java.awt.Dimension preferredLayoutSize(java.awt.Container scrollbarContainer)
preferredLayoutSize in interface java.awt.LayoutManagerscrollbarContainer - The Container to find a size for.LayoutManager.minimumLayoutSize(Container)public void removeLayoutComponent(java.awt.Component child)
removeLayoutComponent in interface java.awt.LayoutManagerchild - The child to remove.protected void scrollByBlock(int direction)
direction - The direction to scroll.protected void scrollByUnit(int direction)
direction - The direction to scroll.protected void setThumbBounds(int x, int y, int width, int height)
x - The X position of the thumb.y - The Y position of the thumb.width - The width of the thumb.height - The height of the thumb.protected void uninstallComponents()
protected void uninstallDefaults()
protected void uninstallListeners()
public void uninstallUI(javax.swing.JComponent c)
uninstallUI in class javax.swing.plaf.ComponentUIc - The Component to uninstall for.ComponentUI.installUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public boolean isThumbRollover()
protected void setThumbRollover(boolean active)
active - - true if the mouse is over the thumb.public boolean getSupportsAbsolutePositioning()