java.lang.Object | |||
↳ | javax.swing.plaf.ComponentUI | ||
↳ | javax.swing.plaf.SliderUI | ||
↳ | javax.swing.plaf.basic.BasicSliderUI |
![]() |
A Basic L&F implementation of SliderUI.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BasicSliderUI.ActionScroller | As of Java 2 platform v1.3 this undocumented class is no longer used. | ||||||||||
BasicSliderUI.ChangeHandler | Data model listener. | ||||||||||
BasicSliderUI.ComponentHandler | Listener for resizing events. | ||||||||||
BasicSliderUI.FocusHandler | Focus-change listener. | ||||||||||
BasicSliderUI.PropertyChangeHandler | |||||||||||
BasicSliderUI.ScrollListener | Scroll-event listener. | ||||||||||
BasicSliderUI.TrackListener | Track mouse movements. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | MAX_SCROLL | ||||||||||
int | MIN_SCROLL | ||||||||||
int | NEGATIVE_SCROLL | ||||||||||
int | POSITIVE_SCROLL |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
changeListener | |||||||||||
componentListener | |||||||||||
contentRect | |||||||||||
focusInsets | |||||||||||
focusListener | |||||||||||
focusRect | |||||||||||
insetCache | |||||||||||
labelRect | |||||||||||
leftToRightCache | |||||||||||
propertyChangeListener | |||||||||||
scrollListener | |||||||||||
scrollTimer | |||||||||||
slider | |||||||||||
thumbRect | |||||||||||
tickRect | |||||||||||
trackBuffer | |||||||||||
trackListener | |||||||||||
trackRect |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the baseline.
| |||||||||||
Returns an enum indicating how the baseline of the component
changes as the size changes.
| |||||||||||
Returns the specified component's maximum size appropriate for
the look and feel.
| |||||||||||
Returns the specified component's minimum size appropriate for
the look and feel.
| |||||||||||
Returns the specified component's preferred size appropriate for
the look and feel.
| |||||||||||
Configures the specified component appropriate for the look and feel.
| |||||||||||
Paints the specified component appropriate for the look and feel.
| |||||||||||
Reverses configuration which was done on the specified component during
installUI . | |||||||||||
Returns a value give an x position.
| |||||||||||
Returns a value give a y position.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the biggest value that has an entry in the label table.
| |||||||||||
Returns the label that corresponds to the lowest slider value in the label table.
| |||||||||||
Returns the smallest value that has an entry in the label table.
| |||||||||||
Returns the label that corresponds to the highest slider value in the label table.
| |||||||||||
Gets the height of the tick area for horizontal sliders and the width of the
tick area for vertical sliders.
| |||||||||||
Returns true if the user is dragging the slider.
| |||||||||||
Returns true if all the labels from the label table have the same
baseline.
| |||||||||||
Called for every label in the label table.
| |||||||||||
Called for every label in the label table.
| |||||||||||
This function is called when a mousePressed was detected in the track, not
in the thumb.
| |||||||||||
Returns the y location for the specified value.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Returns the baseline.
c | JComponent baseline is being requested for |
---|---|
width | the width to get the baseline for |
height | the height to get the baseline for |
Returns an enum indicating how the baseline of the component changes as the size changes.
c | JComponent to return baseline resize behavior for |
---|
NullPointerException |
---|
Returns the specified component's maximum size appropriate for
the look and feel. If 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.
c | the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Dimension
object or null
Returns the specified component's minimum size appropriate for
the look and feel. If null
is returned, the minimum
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.
c | the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Dimension
object or null
Returns the specified component's preferred size appropriate for
the look and feel. If null
is returned, the preferred
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 returns null
.
c | the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Configures the specified component appropriate for the look and feel.
This method is invoked when the 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.
c | the component where this UI delegate is being installed |
---|
Paints the specified component appropriate for the look and feel.
This method is invoked from the 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.
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 |
Reverses configuration which was done on the specified component during
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:
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 |
---|
Returns a value give an x position. If xPos is past the track at the left or the right it will set the value to the min or max of the slider, depending if the slider is inverted or not.
Returns a value give a y position. If yPos is past the track at the top or the bottom it will set the value to the min or max of the slider, depending if the slider is inverted or not.
Returns the biggest value that has an entry in the label table.
Returns the label that corresponds to the lowest slider value in the label table.
Returns the smallest value that has an entry in the label table.
Returns the label that corresponds to the highest slider value in the label table.
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders. BasicSliderUI uses the returned value to determine the tick area rectangle. If you want to give your ticks some room, make this larger than you need and paint your ticks away from the sides in paintTicks().
Returns true if the user is dragging the slider.
Returns true if all the labels from the label table have the same baseline.
Called for every label in the label table. Used to draw the labels for horizontal sliders. The graphics have been translated to labelRect.y already.
Called for every label in the label table. Used to draw the labels for vertical sliders. The graphics have been translated to labelRect.x already.
This function is called when a mousePressed was detected in the track, not in the thumb. The default behavior is to scroll by block. You can override this method to stop it from scrolling or to add additional behavior.
Returns the y location for the specified value. No checking is
done on the arguments. In particular if trackHeight
is
negative undefined results may occur.
value | the slider value to get the location for |
---|---|
trackY | y-origin of the track |
trackHeight | the height of the track |