Class ColorSliderUI

  • All Implemented Interfaces:
    TransitionAwareUI

    public class ColorSliderUI
    extends RadianceSliderUI
    implements TransitionAwareUI
    A UI delegate for color sliders. The track of the slider visualizes how changing the value of the slider affects the color.
    Version:
    1.0.3 2005-09-11 Tweaked layout and drawing code.
    1.0.2 2005-08-28 Color track must always be regenerated if the snapToTicks property changes.
    1.0.1 2005-04-18 Fixed an undesired shift of the track on the x-axis.
    1.0 29 March 2005 Created.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      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
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorSliderUI​(javax.swing.JSlider b)
      Creates a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 int getTickLength()
      Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.
      StateTransitionTracker getTransitionTracker()
      Returns the model for tracking the transitions.
      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.
      private void paintColorTrack​(java.awt.Graphics g, int x, int y, int width, int height, int buffer)  
      void paintFocus​(java.awt.Graphics g)  
      void paintTicks​(java.awt.Graphics g)  
      void paintTrack​(java.awt.Graphics g)  
      protected void uninstallListeners​(javax.swing.JSlider slider)  
      • Methods inherited from class javax.swing.plaf.basic.BasicSliderUI

        calculateContentRect, calculateFocusRect, calculateGeometry, calculateThumbSize, calculateTrackBuffer, createChangeListener, createComponentListener, createFocusListener, createScrollListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumSize, getShadowColor, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installUI, isDragging, labelsHaveSameBaselines, paintHorizontalLabel, paintLabels, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintVerticalLabel, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, uninstallDefaults, 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

      • componentIndex

        protected java.lang.Integer componentIndex
      • thumbModel

        private javax.swing.ButtonModel thumbModel
        Surrogate button model for tracking the thumb transitions.
      • radianceRolloverListener

        private RolloverControlListener radianceRolloverListener
        Listener for transition animations.
      • radiancePropertyChangeListener

        private java.beans.PropertyChangeListener radiancePropertyChangeListener
        Listener on property change events.
      • stateTransitionTracker

        protected StateTransitionTracker stateTransitionTracker
        Listener for transition animations.
      • PREFERRED_HORIZONTAL_SIZE

        private static final java.awt.Dimension PREFERRED_HORIZONTAL_SIZE
      • PREFERRED_VERTICAL_SIZE

        private static final java.awt.Dimension PREFERRED_VERTICAL_SIZE
      • MINIMUM_HORIZONTAL_SIZE

        private static final java.awt.Dimension MINIMUM_HORIZONTAL_SIZE
      • MINIMUM_VERTICAL_SIZE

        private static final java.awt.Dimension MINIMUM_VERTICAL_SIZE
    • 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)
      • 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
      • paintColorTrack

        private void paintColorTrack​(java.awt.Graphics g,
                                     int x,
                                     int y,
                                     int width,
                                     int height,
                                     int buffer)
      • 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 RadianceSliderUI
      • 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
      • isInside

        public boolean isInside​(java.awt.event.MouseEvent me)
        Description copied from interface: TransitionAwareUI
        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 TransitionAwareUI
        Overrides:
        isInside in class RadianceSliderUI
        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.