public class BasicScrollBarUI extends ScrollBarUIimplements LayoutManager , SwingConstants
| Modifier and Type | Class and Description |
|---|---|
protected class |
BasicScrollBarUI
Listener for cursor keys.
|
protected class |
BasicScrollBarUI
A listener to listen for model changes.
|
class |
BasicScrollBarUI
|
protected class |
BasicScrollBarUI
Listener for scrolling events initiated in the
ScrollPane.
|
protected class |
BasicScrollBarUI
Track mouse drags.
|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Constructor and Description |
|---|
BasicScrollBarUI()
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(String
If the layout manager uses a per-component string, adds the component
comp to the layout, associating it with the string specified by
name.
|
protected void |
configureScrollBarColors()
|
protected BasicScrollBarUI |
createArrowButtonListener()
|
protected JButton |
createDecreaseButton(int orientation)
|
protected JButton |
createIncreaseButton(int orientation)
|
protected BasicScrollBarUI |
createModelListener()
|
protected PropertyChangeListener |
createPropertyChangeListener()
|
protected BasicScrollBarUI |
createScrollListener()
|
protected BasicScrollBarUI |
createTrackListener()
|
static ComponentUI |
createUI(JComponent
|
Dimension |
getMaximumSize(JComponent
Returns the specified component's maximum size appropriate for the look and feel.
|
protected Dimension |
getMaximumThumbSize()
Returns the largest acceptable size for the thumb.
|
protected Dimension |
getMinimumThumbSize()
Returns the smallest acceptable size for the thumb.
|
Dimension |
getPreferredSize(JComponent
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.
|
boolean |
getSupportsAbsolutePositioning()
Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button).
|
protected Rectangle |
getThumbBounds()
Return the current size/location of the thumb.
|
protected Rectangle |
getTrackBounds()
Returns the current bounds of the track, i.e.
|
protected void |
installComponents()
|
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent
Configures the specified component appropriately for the look and feel.
|
boolean |
isThumbRollover()
Returns true if the mouse is currently over the thumb.
|
void |
layoutContainer(Container
Lays out the specified container.
|
protected void |
layoutHScrollbar(JScrollBar
|
protected void |
layoutVScrollbar(JScrollBar
|
Dimension |
minimumLayoutSize(Container
Calculates the minimum size dimensions for the specified container, given the components it contains.
|
void |
paint(Graphics
Paints the specified component appropriately for the look and feel.
|
protected void |
paintDecreaseHighlight(Graphics
|
protected void |
paintIncreaseHighlight(Graphics
|
protected void |
paintThumb(Graphics
|
protected void |
paintTrack(Graphics
|
Dimension |
preferredLayoutSize(Container
Calculates the preferred size dimensions for the specified container, given the components it contains.
|
void |
removeLayoutComponent(Component
Removes the specified component from the layout.
|
protected void |
scrollByBlock(int direction)
|
protected void |
scrollByUnit(int direction)
|
protected void |
setThumbBounds(int x, int y, int width, int height)
Set the bounds of the thumb and force a repaint that includes the old thumbBounds and the new one.
|
protected void |
setThumbRollover(boolean active)
Sets whether or not the mouse is currently over the thumb.
|
protected void |
uninstallComponents()
|
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent
Reverses configuration which was done on the specified component during
installUI.
|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, updateprotected DimensionminimumThumbSize
protected DimensionmaximumThumbSize
protected ColorthumbHighlightColor
protected ColorthumbLightShadowColor
protected ColorthumbDarkShadowColor
protected ColorthumbColor
protected ColortrackColor
protected ColortrackHighlightColor
protected JScrollBarscrollbar
protected JButtonincrButton
protected JButtondecrButton
protected boolean isDragging
protected BasicScrollBarUI.TrackListener trackListener
protected BasicScrollBarUI.ArrowButtonListener buttonListener
protected BasicScrollBarUI.ModelListener modelListener
protected RectanglethumbRect
protected RectangletrackRect
protected int trackHighlight
protected static final int NO_HIGHLIGHT
protected static final int DECREASE_HIGHLIGHT
protected static final int INCREASE_HIGHLIGHT
protected BasicScrollBarUI.ScrollListener scrollListener
protected PropertyChangeListenerpropertyChangeListener
protected TimerscrollTimer
protected int scrollBarWidth
protected int incrGap
protected int decrGap
public static ComponentUIcreateUI(JComponent c)
protected void configureScrollBarColors()
public void installUI(JComponentc)
ComponentUI
ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
LayoutManager on the component if necessary. PropertyChangeListener on the component in order to detect and respond to component property changes appropriately. installUI in class
ComponentUI
c - the component where this UI delegate is being installed
ComponentUI.uninstallUI(javax.swing.JComponent) ,
JComponent.setUI(javax.swing.plaf.ComponentUI) ,
JComponent.updateUI()
public void uninstallUI(JComponentc)
ComponentUI
installUI. This method is invoked when this
UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in
installUI, being careful to leave the
JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
uninstallUI in class
ComponentUI
c - the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
ComponentUI.installUI(javax.swing.JComponent) ,
JComponent.updateUI()
protected void installDefaults()
protected void installComponents()
protected void uninstallComponents()
protected void installListeners()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
protected void uninstallListeners()
protected void uninstallDefaults()
protected BasicScrollBarUI.TrackListener createTrackListener()
protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
protected BasicScrollBarUI.ModelListener createModelListener()
protected BasicScrollBarUI.ScrollListener createScrollListener()
protected PropertyChangeListenercreatePropertyChangeListener()
protected void setThumbRollover(boolean active)
active - True indicates the thumb is currently active.
public boolean isThumbRollover()
public void paint(Graphicsg, JComponent c)
ComponentUI
ComponentUI.update method when the specified component is being painted. Subclasses should override this method and use the specified
Graphics object to render the content of the component.
paint in class
ComponentUI
g - the
Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
public DimensiongetPreferredSize(JComponent c)
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.
getPreferredSize in class
ComponentUI
c - the
JScrollBar that's delegating this method to us
getMaximumSize(javax.swing.JComponent),
ComponentUI.getMinimumSize(javax.swing.JComponent)
public DimensiongetMaximumSize(JComponent c)
ComponentUI
null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes
getPreferredSize and returns that value.
getMaximumSize in class
ComponentUI
c - The JScrollBar that's delegating this method to us.
ComponentUI.getMinimumSize(javax.swing.JComponent) ,
getPreferredSize(javax.swing.JComponent)
protected JButtoncreateDecreaseButton(int orientation)
protected JButtoncreateIncreaseButton(int orientation)
protected void paintDecreaseHighlight(Graphicsg)
protected void paintIncreaseHighlight(Graphicsg)
protected void paintTrack(Graphicsg, JComponent c, Rectangle trackBounds)
protected void paintThumb(Graphicsg, JComponent c, Rectangle thumbBounds)
protected DimensiongetMinimumThumbSize()
Warning : the value returned by this method should not be be modified, it's a shared static constant.
getMaximumThumbSize()
protected DimensiongetMaximumThumbSize()
getMinimumThumbSize return the same value.
Warning : the value returned by this method should not be be modified, it's a shared static constant.
getMinimumThumbSize()
public void addLayoutComponent(Stringname, Component child)
LayoutManager
comp to the layout, associating it with the string specified by
name.
addLayoutComponent in interface
LayoutManager
name - the string to be associated with the component
child - the component to be added
public void removeLayoutComponent(Componentchild)
LayoutManager
removeLayoutComponent in interface
LayoutManager
child - the component to be removed
public DimensionpreferredLayoutSize(Container scrollbarContainer)
LayoutManager
preferredLayoutSize in interface
LayoutManager
scrollbarContainer - the container to be laid out
LayoutManager.minimumLayoutSize(java.awt.Container)
public DimensionminimumLayoutSize(Container scrollbarContainer)
LayoutManager
minimumLayoutSize in interface
LayoutManager
scrollbarContainer - the component to be laid out
LayoutManager.preferredLayoutSize(java.awt.Container)
protected void layoutVScrollbar(JScrollBarsb)
protected void layoutHScrollbar(JScrollBarsb)
public void layoutContainer(ContainerscrollbarContainer)
LayoutManager
layoutContainer in interface
LayoutManager
scrollbarContainer - the container to be laid out
protected void setThumbBounds(int x,
int y,
int width,
int height)
getThumbBounds()
protected RectanglegetThumbBounds()
Warning : the value returned by this method should not be be modified, it's a reference to the actual rectangle, not a copy.
setThumbBounds(int, int, int, int)
protected RectanglegetTrackBounds()
Warning : the value returned by this method should not be be modified, it's a reference to the actual rectangle, not a copy.
layoutContainer(java.awt.Container)
protected void scrollByBlock(int direction)
protected void scrollByUnit(int direction)
public boolean getSupportsAbsolutePositioning()