org.jvnet.substance
Class SubstanceSliderUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.SliderUI
          extended by javax.swing.plaf.basic.BasicSliderUI
              extended by org.jvnet.substance.SubstanceSliderUI
All Implemented Interfaces:
Trackable

public class SubstanceSliderUI
extends javax.swing.plaf.basic.BasicSliderUI
implements Trackable

UI for sliders in Substance look and feel.

Author:
Kirill Grouchnikov

Nested Class Summary
 
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  javax.swing.Icon horizontalIcon
          Icon for horizontal sliders.
protected  javax.swing.Icon roundIcon
          Icon for sliders without labels and ticks.
protected  org.jvnet.lafwidget.animation.FadeStateListener substanceFadeStateListener
          Listener for fade animations.
protected  javax.swing.Icon verticalIcon
          Icon for vertical sliders.
 
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
 
Constructor Summary
SubstanceSliderUI(javax.swing.JSlider slider)
          Simple constructor.
 
Method Summary
protected  void calculateLabelRect()
           
protected  void calculateThumbLocation()
           
protected  void calculateTickRect()
           
protected  void calculateTrackRect()
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
 javax.swing.ButtonModel getButtonModel()
          Returns the button model for tracking the thumb transitions.
protected  javax.swing.Icon getIcon()
          Returns the thumb icon for the associated slider.
 java.awt.Dimension getPreferredHorizontalSize()
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
           
 java.awt.Dimension getPreferredVerticalSize()
           
protected  int getThumbOverhang()
          Returns the amount that the thumb goes past the slide bar.
protected  java.awt.Dimension getThumbSize()
           
protected  int getTickLength()
           
protected  int getTrackWidth()
          Returns the shorter dimension of the track.
protected  void installDefaults(javax.swing.JSlider slider)
           
protected  void installListeners(javax.swing.JSlider slider)
           
 boolean isInside(java.awt.event.MouseEvent me)
          Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
 void paintFocus(java.awt.Graphics g)
           
protected  void paintHorizontalLabel(java.awt.Graphics g, int value, java.awt.Component label)
           
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 paintTicks(java.awt.Graphics g)
           
 void paintTrack(java.awt.Graphics g)
           
protected  void paintVerticalLabel(java.awt.Graphics g, int value, java.awt.Component label)
           
 void setThumbLocation(int x, int y)
           
protected  void uninstallListeners(javax.swing.JSlider slider)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicSliderUI
calculateContentRect, calculateFocusRect, calculateGeometry, calculateThumbSize, calculateTrackBuffer, createChangeListener, createComponentListener, createFocusListener, createPropertyChangeListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumSize, getMinimumVerticalSize, getShadowColor, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installUI, isDragging, labelsHaveSameBaselines, paintLabels, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, uninstallKeyboardActions, 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

substanceFadeStateListener

protected org.jvnet.lafwidget.animation.FadeStateListener substanceFadeStateListener
Listener for fade animations.


horizontalIcon

protected javax.swing.Icon horizontalIcon
Icon for horizontal sliders.


roundIcon

protected javax.swing.Icon roundIcon
Icon for sliders without labels and ticks.


verticalIcon

protected javax.swing.Icon verticalIcon
Icon for vertical sliders.

Constructor Detail

SubstanceSliderUI

public SubstanceSliderUI(javax.swing.JSlider slider)
Simple constructor.

Parameters:
slider - Slider.
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

calculateTrackRect

protected void calculateTrackRect()
Overrides:
calculateTrackRect in class javax.swing.plaf.basic.BasicSliderUI

paintTrack

public void paintTrack(java.awt.Graphics g)
Overrides:
paintTrack in class javax.swing.plaf.basic.BasicSliderUI

getThumbSize

protected java.awt.Dimension getThumbSize()
Overrides:
getThumbSize in class javax.swing.plaf.basic.BasicSliderUI

getIcon

protected javax.swing.Icon getIcon()
Returns the thumb icon for the associated slider.

Returns:
The thumb icon for the associated slider.

paintThumb

public void paintThumb(java.awt.Graphics g)
Overrides:
paintThumb in class javax.swing.plaf.basic.BasicSliderUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides:
paint in class javax.swing.plaf.basic.BasicSliderUI

getButtonModel

public javax.swing.ButtonModel getButtonModel()
Returns the button model for tracking the thumb transitions.

Returns:
Button model for tracking the thumb transitions.

isInside

public boolean isInside(java.awt.event.MouseEvent me)
Description copied from interface: Trackable
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.

Specified by:
isInside in interface Trackable
Parameters:
me - Mouse event.
Returns:
true if the mouse position of the specified event lies inside the area of the component designated for transition effects, false otherwise.

installDefaults

protected void installDefaults(javax.swing.JSlider slider)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicSliderUI

installListeners

protected void installListeners(javax.swing.JSlider slider)
Overrides:
installListeners in class javax.swing.plaf.basic.BasicSliderUI

uninstallListeners

protected void uninstallListeners(javax.swing.JSlider slider)
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicSliderUI

paintFocus

public void paintFocus(java.awt.Graphics g)
Overrides:
paintFocus in class javax.swing.plaf.basic.BasicSliderUI

getThumbOverhang

protected int getThumbOverhang()
Returns the amount that the thumb goes past the slide bar.

Returns:
Amount that the thumb goes past the slide bar.

getTrackWidth

protected int getTrackWidth()
Returns the shorter dimension of the track.

Returns:
Shorter dimension of the track.

getTickLength

protected int getTickLength()
Overrides:
getTickLength in class javax.swing.plaf.basic.BasicSliderUI

paintTicks

public void paintTicks(java.awt.Graphics g)
Overrides:
paintTicks in class javax.swing.plaf.basic.BasicSliderUI

paintMajorTickForHorizSlider

protected void paintMajorTickForHorizSlider(java.awt.Graphics g,
                                            java.awt.Rectangle tickBounds,
                                            int x)
Overrides:
paintMajorTickForHorizSlider in class javax.swing.plaf.basic.BasicSliderUI

paintMajorTickForVertSlider

protected void paintMajorTickForVertSlider(java.awt.Graphics g,
                                           java.awt.Rectangle tickBounds,
                                           int y)
Overrides:
paintMajorTickForVertSlider in class javax.swing.plaf.basic.BasicSliderUI

paintMinorTickForHorizSlider

protected void paintMinorTickForHorizSlider(java.awt.Graphics g,
                                            java.awt.Rectangle tickBounds,
                                            int x)
Overrides:
paintMinorTickForHorizSlider in class javax.swing.plaf.basic.BasicSliderUI

paintMinorTickForVertSlider

protected void paintMinorTickForVertSlider(java.awt.Graphics g,
                                           java.awt.Rectangle tickBounds,
                                           int y)
Overrides:
paintMinorTickForVertSlider in class javax.swing.plaf.basic.BasicSliderUI

calculateTickRect

protected void calculateTickRect()
Overrides:
calculateTickRect in class javax.swing.plaf.basic.BasicSliderUI

calculateLabelRect

protected void calculateLabelRect()
Overrides:
calculateLabelRect in class javax.swing.plaf.basic.BasicSliderUI

calculateThumbLocation

protected void calculateThumbLocation()
Overrides:
calculateThumbLocation in class javax.swing.plaf.basic.BasicSliderUI

paintHorizontalLabel

protected void paintHorizontalLabel(java.awt.Graphics g,
                                    int value,
                                    java.awt.Component label)
Overrides:
paintHorizontalLabel in class javax.swing.plaf.basic.BasicSliderUI

paintVerticalLabel

protected void paintVerticalLabel(java.awt.Graphics g,
                                  int value,
                                  java.awt.Component label)
Overrides:
paintVerticalLabel in class javax.swing.plaf.basic.BasicSliderUI

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicSliderUI

setThumbLocation

public void setThumbLocation(int x,
                             int y)
Overrides:
setThumbLocation in class javax.swing.plaf.basic.BasicSliderUI

getPreferredHorizontalSize

public java.awt.Dimension getPreferredHorizontalSize()
Overrides:
getPreferredHorizontalSize in class javax.swing.plaf.basic.BasicSliderUI

getPreferredVerticalSize

public java.awt.Dimension getPreferredVerticalSize()
Overrides:
getPreferredVerticalSize in class javax.swing.plaf.basic.BasicSliderUI