contrib.ch.randelshofer.quaqua.colorchooser
public abstract class ColorSliderModel extends java.lang.Object
Colors are represented as arrays of color components represented as BoundedRangeModel's. Each BoundedRangeModel can be visualized using a JSlider having a ColorSliderUI.
Modifier and Type | Field and Description |
---|---|
protected javax.swing.DefaultBoundedRangeModel[] |
components
Components of the color model.
|
protected int[] |
values
Speed optimization.
|
Modifier | Constructor and Description |
---|---|
protected |
ColorSliderModel(javax.swing.DefaultBoundedRangeModel[] components)
Creates a new ColorSliderModel with an array of BoundedRangeModel's
for the color components.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l) |
protected void |
addColorSlider(javax.swing.JSlider slider) |
void |
configureColorSlider(int component,
javax.swing.JSlider slider)
Configures a JSlider for this ColorSliderModel.
|
protected void |
fireColorChanged(int componentIndex) |
void |
fireStateChanged() |
javax.swing.DefaultBoundedRangeModel |
getBoundedRangeModel(int component)
Returns the bounded range model of the specified color component.
|
java.awt.Color |
getColor() |
int |
getComponentCount()
Returns the number of components of this color component model.
|
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.
|
abstract int |
getRGB() |
int |
getValue(int component)
Returns the value of the specified color component.
|
void |
removeChangeListener(javax.swing.event.ChangeListener l) |
protected void |
removeColorSlider(javax.swing.JSlider slider) |
void |
setColor(java.awt.Color color) |
abstract void |
setRGB(int rgb) |
void |
setValue(int component,
int value)
Sets the value of the specified color component.
|
abstract int |
toRGB(int[] values) |
void |
unconfigureColorSlider(javax.swing.JSlider slider)
Unconfigures a JSlider from this ColorSliderModel.
|
protected javax.swing.DefaultBoundedRangeModel[] components
protected int[] values
protected ColorSliderModel(javax.swing.DefaultBoundedRangeModel[] components)
public void configureColorSlider(int component, javax.swing.JSlider slider)
public void unconfigureColorSlider(javax.swing.JSlider slider)
public int getComponentCount()
public javax.swing.DefaultBoundedRangeModel getBoundedRangeModel(int component)
public int getValue(int component)
public void setValue(int component, int value)
public int getInterpolatedRGB(int component, float ratio)
protected void addColorSlider(javax.swing.JSlider slider)
protected void removeColorSlider(javax.swing.JSlider slider)
public void addChangeListener(javax.swing.event.ChangeListener l)
public void removeChangeListener(javax.swing.event.ChangeListener l)
protected void fireColorChanged(int componentIndex)
public void fireStateChanged()
public java.awt.Color getColor()
public void setColor(java.awt.Color color)
public abstract void setRGB(int rgb)
public abstract int getRGB()
public abstract int toRGB(int[] values)