|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.SliderUI
javax.swing.plaf.basic.BasicSliderUI
ch.randelshofer.gui.plaf.CustomSliderUI
public class CustomSliderUI
CustomSliderUI draws a BackdropBorder in the background of the slider, and draws an Icon as the slider thumb. This allows for easy visual customization of sliders.
Usage:
JSlider s = new JSlider(); s.setUI((SliderUI) CustomSliderUI.createUI(b)); s.setBorder(new BackdropBorder(....)); s.putClientProperty(CustomSliderUI.THUMB_ICON_CLIENT_PROPERTY, new Icon(....));
XXX This class has been implemented for horizontal sliders whithout labels only.
FIXME The thumb can be dragged too far to the left and to the right.
| Nested Class Summary | |
|---|---|
protected class |
CustomSliderUI.MetalPropertyListener
|
| Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicSliderUI |
|---|
javax.swing.plaf.basic.BasicSliderUI.ActionScroller, javax.swing.plaf.basic.BasicSliderUI.ChangeHandler, javax.swing.plaf.basic.BasicSliderUI.ComponentHandler, javax.swing.plaf.basic.BasicSliderUI.FocusHandler, javax.swing.plaf.basic.BasicSliderUI.PropertyChangeHandler, javax.swing.plaf.basic.BasicSliderUI.ScrollListener, javax.swing.plaf.basic.BasicSliderUI.TrackListener |
| Field Summary | |
|---|---|
protected static java.awt.Color |
darkShadowColor
|
protected boolean |
filledSlider
|
protected static java.awt.Color |
highlightColor
|
protected static javax.swing.Icon |
horizThumbIcon
|
protected static java.awt.Color |
shadowColor
|
protected java.lang.String |
SLIDER_FILL
|
static java.lang.String |
THUMB_ICON_CLIENT_PROPERTY
|
protected static java.awt.Color |
thumbColor
|
protected int |
TICK_BUFFER
|
protected static int |
tickLength
|
protected static int |
trackWidth
|
protected static javax.swing.Icon |
vertThumbIcon
|
| Fields inherited from class javax.swing.plaf.basic.BasicSliderUI |
|---|
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, trackRect |
| Fields inherited from interface ch.randelshofer.gui.plaf.PlafConstants |
|---|
ALL, CENTER, EAST, NONE, PROP_BEVEL, WEST |
| Constructor Summary | |
|---|---|
CustomSliderUI()
|
|
| Method Summary | |
|---|---|
protected void |
calculateTrackRect()
The track rect is the area, where the track is painted. |
protected java.beans.PropertyChangeListener |
createPropertyChangeListener(javax.swing.JSlider slider)
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
|
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c)
Gets the minimal size for the component. |
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent c)
Gets the preferred size for the component. |
protected java.lang.String |
getPropertyPrefix()
|
protected java.awt.Dimension |
getRequiredSize(javax.swing.JComponent c,
int trackLength)
Helper method for computing the size of the component. |
protected int |
getThumbOverhang()
Returns the amount that the thumb goes past the slide bar. |
protected java.awt.Dimension |
getThumbSize()
|
protected int |
getTrackWidth()
|
protected void |
installDefaults(javax.swing.JSlider c)
|
void |
installUI(javax.swing.JComponent c)
|
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
|
void |
paintFocus(java.awt.Graphics g)
|
void |
paintThumb(java.awt.Graphics g)
|
void |
paintTrack(java.awt.Graphics g)
|
| Methods inherited from class javax.swing.plaf.basic.BasicSliderUI |
|---|
calculateContentRect, calculateFocusRect, calculateGeometry, calculateLabelRect, calculateThumbLocation, calculateThumbSize, calculateTickRect, calculateTrackBuffer, createChangeListener, createComponentListener, createFocusListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredVerticalSize, getShadowColor, getTickLength, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installListeners, isDragging, labelsHaveSameBaselines, paintHorizontalLabel, paintLabels, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintTicks, paintVerticalLabel, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, setThumbLocation, uninstallKeyboardActions, uninstallListeners, uninstallUI, valueForXPosition, valueForYPosition, xPositionForValue, yPositionForValue, yPositionForValue |
| Methods inherited from class javax.swing.plaf.ComponentUI |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String THUMB_ICON_CLIENT_PROPERTY
protected final int TICK_BUFFER
protected boolean filledSlider
protected static java.awt.Color thumbColor
protected static java.awt.Color highlightColor
protected static java.awt.Color shadowColor
protected static java.awt.Color darkShadowColor
protected static int trackWidth
protected static int tickLength
protected static javax.swing.Icon horizThumbIcon
protected static javax.swing.Icon vertThumbIcon
protected final java.lang.String SLIDER_FILL
| Constructor Detail |
|---|
public CustomSliderUI()
| Method Detail |
|---|
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
protected java.lang.String getPropertyPrefix()
public void installUI(javax.swing.JComponent c)
installUI in class javax.swing.plaf.basic.BasicSliderUIprotected void installDefaults(javax.swing.JSlider c)
installDefaults in class javax.swing.plaf.basic.BasicSliderUIprotected java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JSlider slider)
createPropertyChangeListener in class javax.swing.plaf.basic.BasicSliderUI
public void paint(java.awt.Graphics g,
javax.swing.JComponent c)
paint in class javax.swing.plaf.basic.BasicSliderUIpublic void paintThumb(java.awt.Graphics g)
paintThumb in class javax.swing.plaf.basic.BasicSliderUIpublic void paintTrack(java.awt.Graphics g)
paintTrack in class javax.swing.plaf.basic.BasicSliderUIpublic void paintFocus(java.awt.Graphics g)
paintFocus in class javax.swing.plaf.basic.BasicSliderUIprotected java.awt.Dimension getThumbSize()
getThumbSize in class javax.swing.plaf.basic.BasicSliderUIpublic java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize in class javax.swing.plaf.basic.BasicSliderUIpublic java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
getMinimumSize in class javax.swing.plaf.basic.BasicSliderUI
protected java.awt.Dimension getRequiredSize(javax.swing.JComponent c,
int trackLength)
c - The JSlider.trackLength - The amount of pixels, we want to
be able to move the slider thumb.protected void calculateTrackRect()
calculateTrackRect in class javax.swing.plaf.basic.BasicSliderUIprotected int getTrackWidth()
protected int getThumbOverhang()
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||