public class BasicSliderUI extends SliderUI
| Modifier and Type | Class and Description |
|---|---|
class |
BasicSliderUI
As of Java 2 platform v1.3 this undocumented class is no longer used.
|
class |
BasicSliderUI
Data model listener.
|
class |
BasicSliderUI
Listener for resizing events.
|
class |
BasicSliderUI
Focus-change listener.
|
class |
BasicSliderUI
|
class |
BasicSliderUI
Scroll-event listener.
|
class |
BasicSliderUI
Track mouse movements.
|
| Modifier and Type | Field and Description |
|---|---|
protected ChangeListener |
changeListener
|
protected ComponentListener |
componentListener
|
protected Rectangle |
contentRect
|
protected Insets |
focusInsets
|
protected FocusListener |
focusListener
|
protected Rectangle |
focusRect
|
protected Insets |
insetCache
|
protected Rectangle |
labelRect
|
protected boolean |
leftToRightCache
|
static int |
MAX_SCROLL
|
static int |
MIN_SCROLL
|
static int |
NEGATIVE_SCROLL
|
static int |
POSITIVE_SCROLL
|
protected PropertyChangeListener |
propertyChangeListener
|
protected BasicSliderUI |
scrollListener
|
protected Timer |
scrollTimer
|
protected JSlider |
slider
|
protected Rectangle |
thumbRect
|
protected Rectangle |
tickRect
|
protected int |
trackBuffer
|
protected BasicSliderUI |
trackListener
|
protected Rectangle |
trackRect
|
| Constructor and Description |
|---|
BasicSliderUI(JSlider
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
calculateContentRect()
|
protected void |
calculateFocusRect()
|
protected void |
calculateGeometry()
|
protected void |
calculateLabelRect()
|
protected void |
calculateThumbLocation()
|
protected void |
calculateThumbSize()
|
protected void |
calculateTickRect()
|
protected void |
calculateTrackBuffer()
|
protected void |
calculateTrackRect()
|
protected ChangeListener |
createChangeListener(JSlider
|
protected ComponentListener |
createComponentListener(JSlider
|
protected FocusListener |
createFocusListener(JSlider
|
protected PropertyChangeListener |
createPropertyChangeListener(JSlider
|
protected BasicSliderUI |
createScrollListener(JSlider
|
protected BasicSliderUI |
createTrackListener(JSlider
|
static ComponentUI |
createUI(JComponent
|
protected boolean |
drawInverted()
|
int |
getBaseline(JComponent
Returns the baseline.
|
Component |
getBaselineResizeBehavior(JComponent
Returns an enum indicating how the baseline of the component changes as the size changes.
|
protected Color |
getFocusColor()
|
protected int |
getHeightOfHighValueLabel()
|
protected int |
getHeightOfLowValueLabel()
|
protected int |
getHeightOfTallestLabel()
|
protected Integer |
getHighestValue()
Returns the biggest value that has an entry in the label table.
|
protected Component |
getHighestValueLabel()
Returns the label that corresponds to the lowest slider value in the label table.
|
protected Color |
getHighlightColor()
|
protected Integer |
getLowestValue()
Returns the smallest value that has an entry in the label table.
|
protected Component |
getLowestValueLabel()
Returns the label that corresponds to the highest slider value in the label table.
|
Dimension |
getMaximumSize(JComponent
Returns the specified component's maximum size appropriate for the look and feel.
|
Dimension |
getMinimumHorizontalSize()
|
Dimension |
getMinimumSize(JComponent
Returns the specified component's minimum size appropriate for the look and feel.
|
Dimension |
getMinimumVerticalSize()
|
Dimension |
getPreferredHorizontalSize()
|
Dimension |
getPreferredSize(JComponent
Returns the specified component's preferred size appropriate for the look and feel.
|
Dimension |
getPreferredVerticalSize()
|
protected Color |
getShadowColor()
|
protected Dimension |
getThumbSize()
|
protected int |
getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.
|
protected int |
getWidthOfHighValueLabel()
|
protected int |
getWidthOfLowValueLabel()
|
protected int |
getWidthOfWidestLabel()
|
protected void |
installDefaults(JSlider
|
protected void |
installKeyboardActions(JSlider
|
protected void |
installListeners(JSlider
|
void |
installUI(JComponent
Configures the specified component appropriately for the look and feel.
|
protected boolean |
isDragging()
Returns true if the user is dragging the slider.
|
protected boolean |
labelsHaveSameBaselines()
Returns true if all the labels from the label table have the same baseline.
|
void |
paint(Graphics
Paints the specified component appropriately for the look and feel.
|
void |
paintFocus(Graphics
|
protected void |
paintHorizontalLabel(Graphics
Called for every label in the label table.
|
void |
paintLabels(Graphics
|
protected void |
paintMajorTickForHorizSlider(Graphics
|
protected void |
paintMajorTickForVertSlider(Graphics
|
protected void |
paintMinorTickForHorizSlider(Graphics
|
protected void |
paintMinorTickForVertSlider(Graphics
|
void |
paintThumb(Graphics
|
void |
paintTicks(Graphics
|
void |
paintTrack(Graphics
|
protected void |
paintVerticalLabel(Graphics
Called for every label in the label table.
|
protected void |
recalculateIfInsetsChanged()
|
protected void |
recalculateIfOrientationChanged()
|
void |
scrollByBlock(int direction)
|
void |
scrollByUnit(int direction)
|
protected void |
scrollDueToClickInTrack(int dir)
This function is called when a mousePressed was detected in the track, not in the thumb.
|
void |
setThumbLocation(int x, int y)
|
protected void |
uninstallDefaults(JSlider
|
protected void |
uninstallKeyboardActions(JSlider
|
protected void |
uninstallListeners(JSlider
|
void |
uninstallUI(JComponent
Reverses configuration which was done on the specified component during
installUI.
|
int |
valueForXPosition(int xPos)
Returns the value at the x position.
|
int |
valueForYPosition(int yPos)
Returns the value at the y position.
|
protected int |
xPositionForValue(int value)
|
protected int |
yPositionForValue(int value)
|
protected int |
yPositionForValue(int value, int trackY, int trackHeight)
Returns the y location for the specified value.
|
contains, getAccessibleChild, getAccessibleChildrenCount, updatepublic static final int POSITIVE_SCROLL
public static final int NEGATIVE_SCROLL
public static final int MIN_SCROLL
public static final int MAX_SCROLL
protected TimerscrollTimer
protected JSliderslider
protected InsetsfocusInsets
protected InsetsinsetCache
protected boolean leftToRightCache
protected RectanglefocusRect
protected RectanglecontentRect
protected RectanglelabelRect
protected RectangletickRect
protected RectangletrackRect
protected RectanglethumbRect
protected int trackBuffer
protected BasicSliderUI.TrackListener trackListener
protected ChangeListenerchangeListener
protected ComponentListenercomponentListener
protected FocusListenerfocusListener
protected BasicSliderUI.ScrollListener scrollListener
protected PropertyChangeListenerpropertyChangeListener
public BasicSliderUI(JSliderb)
protected ColorgetShadowColor()
protected ColorgetHighlightColor()
protected ColorgetFocusColor()
protected boolean isDragging()
public static ComponentUIcreateUI(JComponent b)
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(JSliderslider)
protected void uninstallDefaults(JSliderslider)
protected BasicSliderUI.TrackListener createTrackListener(JSlider slider)
protected ChangeListenercreateChangeListener(JSlider slider)
protected ComponentListenercreateComponentListener(JSlider slider)
protected FocusListenercreateFocusListener(JSlider slider)
protected BasicSliderUI.ScrollListener createScrollListener(JSlider slider)
protected PropertyChangeListenercreatePropertyChangeListener(JSlider slider)
protected void installListeners(JSliderslider)
protected void uninstallListeners(JSliderslider)
protected void installKeyboardActions(JSliderslider)
protected void uninstallKeyboardActions(JSliderslider)
public int getBaseline(JComponentc, int width, int height)
getBaseline in class
ComponentUI
c -
JComponent baseline is being requested for
width - the width to get the baseline for
height - the height to get the baseline for
NullPointerException - if
c is
null
IllegalArgumentException - if width or height is < 0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior in class
ComponentUI
c -
JComponent to return baseline resize behavior for
NullPointerException - if
c is
null
JComponent.getBaseline(int, int)
protected boolean labelsHaveSameBaselines()
public DimensiongetPreferredHorizontalSize()
public DimensiongetPreferredVerticalSize()
public DimensiongetMinimumHorizontalSize()
public DimensiongetMinimumVerticalSize()
public DimensiongetPreferredSize(JComponent c)
ComponentUI
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.
getPreferredSize in class
ComponentUI
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
JComponent.getPreferredSize() ,
LayoutManager.preferredLayoutSize(java.awt.Container)
public DimensiongetMinimumSize(JComponent c)
ComponentUI
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.
getMinimumSize in class
ComponentUI
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
JComponent.getMinimumSize() ,
LayoutManager.minimumLayoutSize(java.awt.Container) ,
ComponentUI.getPreferredSize(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 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
JComponent.getMaximumSize() ,
LayoutManager2.maximumLayoutSize(java.awt.Container)
protected void calculateGeometry()
protected void calculateFocusRect()
protected void calculateThumbSize()
protected void calculateContentRect()
protected void calculateThumbLocation()
protected void calculateTrackBuffer()
protected void calculateTrackRect()
protected int getTickLength()
protected void calculateTickRect()
protected void calculateLabelRect()
protected DimensiongetThumbSize()
protected int getWidthOfWidestLabel()
protected int getHeightOfTallestLabel()
protected int getWidthOfHighValueLabel()
protected int getWidthOfLowValueLabel()
protected int getHeightOfHighValueLabel()
protected int getHeightOfLowValueLabel()
protected boolean drawInverted()
protected IntegergetHighestValue()
protected IntegergetLowestValue()
protected ComponentgetLowestValueLabel()
protected ComponentgetHighestValueLabel()
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)
protected void recalculateIfInsetsChanged()
protected void recalculateIfOrientationChanged()
public void paintFocus(Graphicsg)
public void paintTrack(Graphicsg)
public void paintTicks(Graphicsg)
protected void paintMinorTickForHorizSlider(Graphicsg, Rectangle tickBounds, int x)
protected void paintMajorTickForHorizSlider(Graphicsg, Rectangle tickBounds, int x)
protected void paintMinorTickForVertSlider(Graphicsg, Rectangle tickBounds, int y)
protected void paintMajorTickForVertSlider(Graphicsg, Rectangle tickBounds, int y)
public void paintLabels(Graphicsg)
protected void paintHorizontalLabel(Graphicsg, int value, Component label)
protected void paintVerticalLabel(Graphicsg, int value, Component label)
public void paintThumb(Graphicsg)
public void setThumbLocation(int x,
int y)public void scrollByBlock(int direction)
public void scrollByUnit(int direction)
protected void scrollDueToClickInTrack(int dir)
protected int xPositionForValue(int value)
protected int yPositionForValue(int value)
protected int yPositionForValue(int value,
int trackY,
int trackHeight)
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
public int valueForYPosition(int yPos)
yPos is beyond the track at the the bottom or the top, this method sets the value to either the minimum or maximum value of the slider, depending on if the slider is inverted or not.
public int valueForXPosition(int xPos)
xPos is beyond the track at the left or the right, this method sets the value to either the minimum or maximum value of the slider, depending on if the slider is inverted or not.