DESY ACOP Beans Home

com.cosylab.gui.components.slider
Class CosySliderUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.SliderUI
          extended by javax.swing.plaf.basic.BasicSliderUI
              extended by javax.swing.plaf.metal.MetalSliderUI
                  extended by com.cosylab.gui.components.slider.CosySliderUI

public class CosySliderUI
extends javax.swing.plaf.metal.MetalSliderUI

This is customized Swing l&f for JSlider.

Version:
$id$
Author:
Ales Pucelj

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.plaf.metal.MetalSliderUI
javax.swing.plaf.metal.MetalSliderUI.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[] GREEN_LED
           
protected static java.awt.Color[] GREY_LED
           
protected  java.awt.image.BufferedImage horizTrailerBuffer
           
protected static java.awt.Color[] RED_LED
           
protected  java.awt.Rectangle trailerCache
           
protected  double trailerPosition
           
protected  java.awt.Rectangle trailerRect
           
protected  javax.swing.Icon vertTrailerIcon
           
protected static java.awt.Color[] YELLOW_LED
           
 
Fields inherited from class javax.swing.plaf.metal.MetalSliderUI
darkShadowColor, filledSlider, highlightColor, horizThumbIcon, SLIDER_FILL, thumbColor, TICK_BUFFER, tickLength, trackWidth, 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
 
Constructor Summary
CosySliderUI(RangedValueController range)
          Creates a new CosySliderUI object.
 
Method Summary
protected  void calculateTrailerLocation()
           
 java.lang.String getFormat()
          Returns the format used by this ui to format the ticks.
protected  java.awt.Color[] getIndicatorColor()
           
 double getTolerance()
          Returns the tolerance.
protected  java.awt.image.BufferedImage getTrailer()
          Returns the image used to display the trailer.
 double getTrailerPosition()
          Returns the position of the slider trailer.
 boolean isPaintTrailer()
          Returns a flag indicating whether the trailer is painted or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
 void paintLabels(java.awt.Graphics g)
           
 void paintThumb(java.awt.Graphics g)
           
 void paintTicks(java.awt.Graphics g)
           
 void paintTrailer(java.awt.Graphics g)
          Paints the trailer.
protected  void scrollDueToClickInTrack(int dir)
           
 void setFormat(java.lang.String format)
          Sets the value display format.
 void setPaintTrailer(boolean paint)
          Sets the flag whether the trailer should be painted or not.
 void setTolerance(double tol)
          Sets the tolerance.
 void setTrailerPosition(double value)
          Sets the slider trailer position.
 
Methods inherited from class javax.swing.plaf.metal.MetalSliderUI
createPropertyChangeListener, createUI, getThumbOverhang, getThumbSize, getTickLength, getTrackLength, getTrackWidth, installUI, paintFocus, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintTrack
 
Methods inherited from class javax.swing.plaf.basic.BasicSliderUI
calculateContentRect, calculateFocusRect, calculateGeometry, calculateLabelRect, calculateThumbLocation, calculateThumbSize, calculateTickRect, calculateTrackBuffer, calculateTrackRect, createChangeListener, createComponentListener, createFocusListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredSize, getPreferredVerticalSize, getShadowColor, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installDefaults, installKeyboardActions, installListeners, isDragging, labelsHaveSameBaselines, paintHorizontalLabel, paintVerticalLabel, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, 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

vertTrailerIcon

protected javax.swing.Icon vertTrailerIcon

horizTrailerBuffer

protected java.awt.image.BufferedImage horizTrailerBuffer

trailerRect

protected java.awt.Rectangle trailerRect

trailerCache

protected java.awt.Rectangle trailerCache

trailerPosition

protected double trailerPosition

GREEN_LED

protected static final java.awt.Color[] GREEN_LED

RED_LED

protected static final java.awt.Color[] RED_LED

YELLOW_LED

protected static final java.awt.Color[] YELLOW_LED

GREY_LED

protected static final java.awt.Color[] GREY_LED
Constructor Detail

CosySliderUI

public CosySliderUI(RangedValueController range)
Creates a new CosySliderUI object.

Parameters:
range -
Method Detail

getTrailer

protected java.awt.image.BufferedImage getTrailer()
Returns the image used to display the trailer. This method uses lazy initialization and loads the image using the IconHelper class.

Returns:
BufferedImage

calculateTrailerLocation

protected void calculateTrailerLocation()

getTrailerPosition

public double getTrailerPosition()
Returns the position of the slider trailer.

Returns:
double

setTrailerPosition

public void setTrailerPosition(double value)
Sets the slider trailer position.

Parameters:
value - new position

paintTrailer

public void paintTrailer(java.awt.Graphics g)
Paints the trailer.

Parameters:
g - destination graphics

getIndicatorColor

protected java.awt.Color[] getIndicatorColor()

paintThumb

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

paint

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

paintTicks

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

paintLabels

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

scrollDueToClickInTrack

protected void scrollDueToClickInTrack(int dir)
Overrides:
scrollDueToClickInTrack in class javax.swing.plaf.metal.MetalSliderUI

setFormat

public void setFormat(java.lang.String format)
Sets the value display format.

Parameters:
format - new format

setTolerance

public void setTolerance(double tol)
Sets the tolerance. This is the tolerance at which the thumb is considered to be synchronized with the trailer.

Parameters:
tol - new tolerance

getTolerance

public double getTolerance()
Returns the tolerance.

Returns:

setPaintTrailer

public void setPaintTrailer(boolean paint)
Sets the flag whether the trailer should be painted or not.

Parameters:
paint -

isPaintTrailer

public boolean isPaintTrailer()
Returns a flag indicating whether the trailer is painted or not.

Returns:

getFormat

public java.lang.String getFormat()
Returns the format used by this ui to format the ticks.

Returns:


Copyright © 2010. All Rights Reserved.