Class ColorSliderModel

    • Field Detail

      • values

        protected int[] values
        Speed optimization. This way, we do not need to create a new array for each invocation of method getInterpolatedRGB(). Note: This variable must not use in reentrant methods.
    • Constructor Detail

      • ColorSliderModel

        protected ColorSliderModel​(DefaultBoundedRangeModel[] components)
        Creates a new ColorSliderModel with an array of BoundedRangeModel's for the color components.
    • Method Detail

      • configureColorSlider

        public void configureColorSlider​(int component,
                                         JSlider slider)
        Configures a JSlider for this ColorSliderModel. If the JSlider is already configured for another ColorSliderModel, it is unconfigured first.
      • unconfigureColorSlider

        public void unconfigureColorSlider​(JSlider slider)
        Unconfigures a JSlider from this ColorSliderModel.
      • getComponentCount

        public int getComponentCount()
        Returns the number of components of this color component model.
      • getBoundedRangeModel

        public DefaultBoundedRangeModel getBoundedRangeModel​(int component)
        Returns the bounded range model of the specified color component.
      • getValue

        public int getValue​(int component)
        Returns the value of the specified color component.
      • setValue

        public void setValue​(int component,
                             int value)
        Sets the value of the specified color component.
      • getInterpolatedRGB

        public int getInterpolatedRGB​(int component,
                                      float ratio)
        Returns an interpolated RGB value by using the values of the color components of this ColorSliderModel except for the component specified as an argument. For this component the ratio between zero and the maximum of its BoundedRangeModel is used.
      • addColorSlider

        protected void addColorSlider​(JSlider slider)
      • removeColorSlider

        protected void removeColorSlider​(JSlider slider)
      • addChangeListener

        public void addChangeListener​(ChangeListener l)
      • removeChangeListener

        public void removeChangeListener​(ChangeListener l)
      • fireColorChanged

        protected void fireColorChanged​(int componentIndex)
      • fireStateChanged

        public void fireStateChanged()
      • getColor

        public Color getColor()
      • setColor

        public void setColor​(Color color)
      • setRGB

        public abstract void setRGB​(int rgb)
      • getRGB

        public abstract int getRGB()
      • toRGB

        public abstract int toRGB​(int[] values)