JHotDraw 7.4.1

org.jhotdraw.color
Class ColorSliderUI

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.jhotdraw.color.ColorSliderUI

public class ColorSliderUI
extends javax.swing.plaf.basic.BasicSliderUI

A UI delegate for color sliders. The track of the slider visualizes how changing the value of the slider affects the color.

Version:
$Id: ColorSliderUI.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer

Nested Class Summary
 class ColorSliderUI.CSUIPropertyChangeHandler
           
 class ColorSliderUI.QuaquaTrackListener
          Track mouse movements.
 
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
 
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
ColorSliderUI(javax.swing.JSlider b)
          Creates a new instance.
 
Method Summary
protected  void calculateThumbLocation()
           
protected  void calculateTickRect()
           
protected  void calculateTrackRect()
           
protected  java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JSlider slider)
           
protected  javax.swing.plaf.basic.BasicSliderUI.TrackListener createTrackListener(javax.swing.JSlider slider)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent b)
           
 java.awt.Dimension getMinimumHorizontalSize()
           
 java.awt.Dimension getMinimumVerticalSize()
           
 java.awt.Dimension getPreferredHorizontalSize()
           
 java.awt.Dimension getPreferredVerticalSize()
           
protected  javax.swing.Icon getThumbIcon()
           
protected  java.awt.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  void installDefaults(javax.swing.JSlider slider)
           
 void paintColorTrack(java.awt.Graphics g, int x, int y, int width, int height, int buffer)
           
 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 paintTicks(java.awt.Graphics g)
           
 void paintTrack(java.awt.Graphics g)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicSliderUI
calculateContentRect, calculateFocusRect, calculateGeometry, calculateLabelRect, calculateThumbSize, calculateTrackBuffer, createChangeListener, createComponentListener, createFocusListener, createScrollListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumSize, getPreferredSize, getShadowColor, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installListeners, installUI, isDragging, labelsHaveSameBaselines, paint, paintHorizontalLabel, paintLabels, 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
 

Constructor Detail

ColorSliderUI

public ColorSliderUI(javax.swing.JSlider b)
Creates a new instance.

Method Detail

createUI

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

installDefaults

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

getThumbSize

protected java.awt.Dimension getThumbSize()
Overrides:
getThumbSize 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

getMinimumHorizontalSize

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

getMinimumVerticalSize

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

calculateThumbLocation

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

getThumbIcon

protected javax.swing.Icon getThumbIcon()

paintThumb

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

paintTrack

public void paintTrack(java.awt.Graphics g)
Overrides:
paintTrack 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

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

paintMajorTickForVertSlider

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

paintFocus

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

paintColorTrack

public void paintColorTrack(java.awt.Graphics g,
                            int x,
                            int y,
                            int width,
                            int height,
                            int buffer)

calculateTrackRect

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

calculateTickRect

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

getTickLength

protected int getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders. BasicSliderUI uses the returned value to determine the tick area rectangle. If you want to give your ticks some room, make this larger than you need and paint your ticks away from the sides in paintTicks().

Overrides:
getTickLength in class javax.swing.plaf.basic.BasicSliderUI

createPropertyChangeListener

protected java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JSlider slider)
Overrides:
createPropertyChangeListener in class javax.swing.plaf.basic.BasicSliderUI

createTrackListener

protected javax.swing.plaf.basic.BasicSliderUI.TrackListener createTrackListener(javax.swing.JSlider slider)
Overrides:
createTrackListener in class javax.swing.plaf.basic.BasicSliderUI

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.