|
Copyright 2012-02-25 Werner Randelshofer | ||||||||
| 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.ImageSliderUI
public class ImageSliderUI
A Java L&F implementation of SliderUI.
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 |
ImageSliderUI.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
|
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 | |
|---|---|
ImageSliderUI()
|
|
| Method Summary | |
|---|---|
protected void |
calculateContentRect()
The content rectangle is inside the focus rectangle of the component. |
protected void |
calculateFocusRect()
The focus rectangle is inside the border insets of the component. |
protected void |
calculateThumbLocation()
|
protected void |
calculateTrackBuffer()
The distance that the track is from the side of the control. |
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()
|
int |
getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders. |
protected int |
getTrackLength()
Returns the longer dimension of the slide bar. |
protected int |
getTrackWidth()
Returns the shorter dimension of the track. |
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)
|
protected void |
paintMajorTickForHorizSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int x)
|
protected void |
paintMajorTickForVertSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int y)
|
protected void |
paintMinorTickForHorizSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int x)
|
protected void |
paintMinorTickForVertSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int y)
|
void |
paintThumb(java.awt.Graphics g)
|
void |
paintTrack(java.awt.Graphics g)
|
protected void |
recalculateIfInsetsChanged()
Recalculates the geometry, if the insets of the slider have changed. |
protected void |
scrollDueToClickInTrack(int dir)
|
int |
valueForXPosition(int xPos)
Returns a value give an x position. |
protected int |
xPositionForValue(int value)
|
| Methods inherited from class javax.swing.plaf.basic.BasicSliderUI |
|---|
calculateGeometry, calculateLabelRect, calculateThumbSize, calculateTickRect, createChangeListener, createComponentListener, createFocusListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredVerticalSize, getShadowColor, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installListeners, isDragging, labelsHaveSameBaselines, paintHorizontalLabel, paintLabels, paintTicks, paintVerticalLabel, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, setThumbLocation, uninstallKeyboardActions, uninstallListeners, uninstallUI, valueForYPosition, 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 |
|---|
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 ImageSliderUI()
| 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 recalculateIfInsetsChanged()
recalculateIfInsetsChanged in class javax.swing.plaf.basic.BasicSliderUIprotected void calculateFocusRect()
Prerequisites: The insetCache variable must have been updated before this method can be called. Otherwise the result is undefined.
calculateFocusRect in class javax.swing.plaf.basic.BasicSliderUIprotected void calculateContentRect()
Prerequisites: calculateFocusRect must have been called before this method can be called. Otherwise the result is undefined.
calculateContentRect in class javax.swing.plaf.basic.BasicSliderUIprotected void calculateTrackBuffer()
Prerequisites: calculateContentRect must have been called before this method can be called. Otherwise the result is undefined.
calculateTrackBuffer in class javax.swing.plaf.basic.BasicSliderUIprotected void calculateTrackRect()
calculateTrackRect in class javax.swing.plaf.basic.BasicSliderUIprotected void calculateThumbLocation()
calculateThumbLocation in class javax.swing.plaf.basic.BasicSliderUIpublic int getTickLength()
getTickLength in class javax.swing.plaf.basic.BasicSliderUIprotected int getTrackWidth()
protected int xPositionForValue(int value)
xPositionForValue in class javax.swing.plaf.basic.BasicSliderUIpublic int valueForXPosition(int xPos)
valueForXPosition in class javax.swing.plaf.basic.BasicSliderUIprotected int getTrackLength()
protected int getThumbOverhang()
protected void scrollDueToClickInTrack(int dir)
scrollDueToClickInTrack in class javax.swing.plaf.basic.BasicSliderUI
protected void paintMinorTickForHorizSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int x)
paintMinorTickForHorizSlider in class javax.swing.plaf.basic.BasicSliderUI
protected void paintMajorTickForHorizSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int x)
paintMajorTickForHorizSlider in class javax.swing.plaf.basic.BasicSliderUI
protected void paintMinorTickForVertSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int y)
paintMinorTickForVertSlider in class javax.swing.plaf.basic.BasicSliderUI
protected void paintMajorTickForVertSlider(java.awt.Graphics g,
java.awt.Rectangle tickBounds,
int y)
paintMajorTickForVertSlider in class javax.swing.plaf.basic.BasicSliderUI
|
Copyright 2012-02-25 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||