public class SynthSliderUI extends BasicSliderUIimplements PropertyChangeListener , SynthUI
JSlider.
BasicSliderUI.ActionScroller , BasicSliderUI.ChangeHandler , BasicSliderUI.ComponentHandler , BasicSliderUI.FocusHandler , BasicSliderUI.PropertyChangeHandler , BasicSliderUI.ScrollListener , BasicSliderUI.TrackListener changeListener, componentListener, contentRect, focusInsets, focusListener, focusRect, insetCache, labelRect, leftToRightCache, MAX_SCROLL, MIN_SCROLL, NEGATIVE_SCROLL, POSITIVE_SCROLL, propertyChangeListener, scrollListener, scrollTimer, slider, thumbRect, tickRect, trackBuffer, trackListener, trackRectDEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED| Modifier | Constructor and Description |
|---|---|
protected |
SynthSliderUI(JSlider
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
calculateGeometry()
|
protected void |
calculateThumbLocation()
|
protected BasicSliderUI |
createTrackListener(JSlider
|
static ComponentUI |
createUI(JComponent
Creates a new UI object for the given component.
|
int |
getBaseline(JComponent
Returns the baseline.
|
SynthContext |
getContext(JComponent
Returns the Context for the specified component.
|
Dimension |
getMinimumSize(JComponent
Returns the specified component's minimum size appropriate for the look and feel.
|
Dimension |
getPreferredSize(JComponent
Returns the specified component's preferred size appropriate for the look and feel.
|
protected Dimension |
getThumbSize()
|
protected void |
installDefaults(JSlider
|
protected void |
installListeners(JSlider
|
protected void |
layout()
Lays out the slider.
|
void |
paint(Graphics
Paints the specified component according to the Look and Feel.
|
protected void |
paint(SynthContext
Paints the specified component.
|
void |
paintBorder(SynthContext
Paints the border.
|
protected void |
paintThumb(SynthContext
Paints the slider thumb.
|
protected void |
paintTrack(SynthContext
Paints the slider track.
|
void |
propertyChange(PropertyChangeEvent
This method gets called when a bound property is changed.
|
protected void |
recalculateIfInsetsChanged()
|
void |
setThumbLocation(int x, int y)
|
protected void |
uninstallDefaults(JSlider
Uninstalls default setting.
|
protected void |
uninstallListeners(JSlider
|
void |
update(Graphics
Notifies this UI delegate to repaint the specified component.
|
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, int trackY, int trackHeight)
Returns the y location for the specified value.
|
calculateContentRect, calculateFocusRect, calculateLabelRect, calculateThumbSize, calculateTickRect, calculateTrackBuffer, calculateTrackRect, createChangeListener, createComponentListener, createFocusListener, createPropertyChangeListener, createScrollListener, drawInverted, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredVerticalSize, getShadowColor, getTickLength, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installUI, isDragging, labelsHaveSameBaselines, paintFocus, paintHorizontalLabel, paintLabels, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintThumb, paintTicks, paintTrack, paintVerticalLabel, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, uninstallKeyboardActions, uninstallUI, yPositionForValuecontains, getAccessibleChild, getAccessibleChildrenCountprotected SynthSliderUI(JSliderc)
public static ComponentUIcreateUI(JComponent c)
c - component to create UI object for
protected void installDefaults(JSliderslider)
protected void uninstallDefaults(JSliderslider)
LookAndFeel is uninstalled.
protected void installListeners(JSliderslider)
protected void uninstallListeners(JSliderslider)
protected BasicSliderUI.TrackListener createTrackListener(JSlider s)
public int getBaseline(JComponentc, int width, int height)
getBaseline in class
BasicSliderUI
c -
JComponent baseline is being requested for
width - the width to get the baseline for
height - the height to get the baseline for
JComponent.getBaseline(int, int)
public DimensiongetPreferredSize(JComponent c)
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
BasicSliderUI
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)
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
BasicSliderUI
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)
protected void calculateGeometry()
protected void layout()
protected void calculateThumbLocation()
public void setThumbLocation(int x,
int y)
protected int xPositionForValue(int value)
protected int yPositionForValue(int value,
int trackY,
int trackHeight)
trackHeight is negative undefined results may occur.
yPositionForValue in class
BasicSliderUI
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.
protected DimensiongetThumbSize()
protected void recalculateIfInsetsChanged()
public SynthContextgetContext(JComponent c)
getContext in interface
SynthUI
c - Component requesting SynthContext.
public void update(Graphicsg, JComponent c)
paint(SynthContext,Graphics) method.
In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the paint method.
update in class
ComponentUI
g - the
Graphics object used for painting
c - the component being painted
paint(SynthContext,Graphics)
public void paint(Graphicsg, JComponent c)
This method is not used by Synth Look and Feel. Painting is handled by the paint(SynthContext,Graphics) method.
paint in class
BasicSliderUI
g - the
Graphics object used for painting
c - the component being painted
paint(SynthContext,Graphics)
protected void paint(SynthContextcontext, Graphics g)
context - context for the component being painted
g - the
Graphics object used for painting
update(Graphics,JComponent)
public void paintBorder(SynthContextcontext, Graphics g, int x, int y, int w, int h)
paintBorder in interface
SynthUI
context - a component context
g -
Graphics to paint on
x - the X coordinate
y - the Y coordinate
w - width of the border
h - height of the border
protected void paintThumb(SynthContextcontext, Graphics g, Rectangle thumbBounds)
context - context for the component being painted
g -
Graphics object used for painting
thumbBounds - bounding box for the thumb
protected void paintTrack(SynthContextcontext, Graphics g, Rectangle trackBounds)
context - context for the component being painted
g -
Graphics object used for painting
trackBounds - bounding box for the track
public void propertyChange(PropertyChangeEvente)
propertyChange in interface
PropertyChangeListener
e - A PropertyChangeEvent object describing the event source and the property that has changed.