org.jhotdraw.color
Class DefaultColorSliderModel
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.color.AbstractColorSlidersModel
-
- org.jhotdraw.color.DefaultColorSliderModel
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ColorSliderModel
- Direct Known Subclasses:
- PaletteColorSliderModel
public class DefaultColorSliderModel extends AbstractColorSlidersModel
DefaultColorSliderModel.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DefaultColorSliderModel()Creates a color slider model with an ICC sRGB color space.DefaultColorSliderModel(java.awt.color.ColorSpace sys)Creates a color slider model with the specified color space.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddColorSlider(javax.swing.JSlider slider)voidconfigureSlider(int componentIndex, javax.swing.JSlider slider)Configures a JSlider for this model.javax.swing.DefaultBoundedRangeModelgetBoundedRangeModel(int componentIndex)Returns the bounded range model of the specified color componentIndex.java.awt.ColorgetColor()Returns the color value of the model.java.awt.color.ColorSpacegetColorSpace()Returns the ColorSpace used by this ColorSliderModel.floatgetComponent(int i)Gets a value of an individual component.intgetComponentCount()Returns the number of components used by this ColorSliderModel.float[]getComponents()Gets all component values.intgetInterpolatedRGB(int i, float componentValue)Returns an RGB value based on the value of the specified component index and value, based on the values of all other components of the model.intgetSliderValue(int componentIndex)Returns the value of the specified color componentIndex.voidremoveColorSlider(javax.swing.JSlider slider)voidsetColor(java.awt.Color newValue)Sets the color value of the model.voidsetColorSpace(java.awt.color.ColorSpace newValue)Changes the ColorSpace used by this ColorSliderModel.voidsetComponent(int i, float newValue)Sets a value for an individual component.voidsetSliderValue(int componentIndex, int value)Sets the value of the specified color componentIndex.voidunconfigureSlider(javax.swing.JSlider slider)Unconfigures a JSlider from this model.-
Methods inherited from class org.jhotdraw.color.AbstractColorSlidersModel
addChangeListener, fireStateChanged, removeChangeListener
-
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
DefaultColorSliderModel
public DefaultColorSliderModel()
Creates a color slider model with an ICC sRGB color space.
-
DefaultColorSliderModel
public DefaultColorSliderModel(java.awt.color.ColorSpace sys)
Creates a color slider model with the specified color space.
-
-
Method Detail
-
setColorSpace
public void setColorSpace(java.awt.color.ColorSpace newValue)
Description copied from interface:ColorSliderModelChanges the ColorSpace used by this ColorSliderModel.- Parameters:
newValue- ColorSpace.
-
configureSlider
public void configureSlider(int componentIndex, javax.swing.JSlider slider)Configures a JSlider for this model. If the JSlider is already configured for another model, it is unconfigured first.
-
unconfigureSlider
public void unconfigureSlider(javax.swing.JSlider slider)
Unconfigures a JSlider from this model.
-
getBoundedRangeModel
public javax.swing.DefaultBoundedRangeModel getBoundedRangeModel(int componentIndex)
Returns the bounded range model of the specified color componentIndex.- Parameters:
componentIndex- .- Returns:
- BoundedRangeModel.
-
getSliderValue
public int getSliderValue(int componentIndex)
Returns the value of the specified color componentIndex.
-
setSliderValue
public void setSliderValue(int componentIndex, int value)Sets the value of the specified color componentIndex.
-
addColorSlider
public void addColorSlider(javax.swing.JSlider slider)
-
removeColorSlider
public void removeColorSlider(javax.swing.JSlider slider)
-
getColorSpace
public java.awt.color.ColorSpace getColorSpace()
Description copied from interface:ColorSliderModelReturns the ColorSpace used by this ColorSliderModel.- Returns:
- ColorSpace.
-
getComponentCount
public int getComponentCount()
Description copied from interface:ColorSliderModelReturns the number of components used by this ColorSliderModel.- Returns:
- Component count.
-
getColor
public java.awt.Color getColor()
Description copied from interface:ColorSliderModelReturns the color value of the model. This is a convenience method for calling getCompositeColor().getColor().- Returns:
- color.
-
getInterpolatedRGB
public int getInterpolatedRGB(int i, float componentValue)Description copied from interface:ColorSliderModelReturns an RGB value based on the value of the specified component index and value, based on the values of all other components of the model.- Returns:
- RGB value.
-
setComponent
public void setComponent(int i, float newValue)Description copied from interface:ColorSliderModelSets a value for an individual component.
-
getComponent
public float getComponent(int i)
Description copied from interface:ColorSliderModelGets a value of an individual component.- Returns:
- Value
-
setColor
public void setColor(java.awt.Color newValue)
Description copied from interface:ColorSliderModelSets the color value of the model. This is a convenience method for calling setCompositeColor(new CompositeColor(getColorSpace(), color.getRGB());- Parameters:
newValue- .
-
getComponents
public float[] getComponents()
Description copied from interface:ColorSliderModelGets all component values.- Returns:
- Values.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG