Class PaletteListModel
- java.lang.Object
-
- javax.swing.AbstractListModel
-
- org.pushingpixels.radiance.theming.internal.contrib.randelshofer.quaqua.colorchooser.PaletteListModel
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.ListModel
public class PaletteListModel extends javax.swing.AbstractListModelPaletteListModel manages a list of PaletteEntry.- Version:
- 1.0 19 septembre 2005 Created.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intclosestIndexIndex of the color which is closest to the current color in the color chooser.private PaletteEntry[]entriesprivate java.lang.StringinfoInformatation about the palette, such as the copyright.private java.lang.StringnameName of the palette.
-
Constructor Summary
Constructors Constructor Description PaletteListModel(java.lang.String name, java.lang.String info, PaletteEntry[] entries)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomputeClosestIndex(java.awt.Color referenceColor)Computes the index of the color which comes closest to the specified color.intgetClosestIndex()Returns the index of the color which is closest to the current color in the color chooser, or -1 of no such color exists.java.lang.ObjectgetElementAt(int index)java.lang.StringgetInfo()java.lang.StringgetName()intgetSize()voidsetClosestIndex(int newValue)Sets the index of the color which is closest to the current color in the color chooser.voidsetInfo(java.lang.String newValue)voidsetName(java.lang.String newValue)java.lang.StringtoString()Used for displaying the name of the palette in the combo box of the ColorPalettesChooser.
-
-
-
Field Detail
-
name
private java.lang.String name
Name of the palette.
-
info
private java.lang.String info
Informatation about the palette, such as the copyright.
-
entries
private PaletteEntry[] entries
-
closestIndex
private int closestIndex
Index of the color which is closest to the current color in the color chooser.
-
-
Constructor Detail
-
PaletteListModel
public PaletteListModel(java.lang.String name, java.lang.String info, PaletteEntry[] entries)Creates a new instance.
-
-
Method Detail
-
setName
public void setName(java.lang.String newValue)
-
getName
public java.lang.String getName()
-
setInfo
public void setInfo(java.lang.String newValue)
-
getInfo
public java.lang.String getInfo()
-
getElementAt
public java.lang.Object getElementAt(int index)
-
getSize
public int getSize()
-
toString
public java.lang.String toString()
Used for displaying the name of the palette in the combo box of the ColorPalettesChooser.- Overrides:
toStringin classjava.lang.Object
-
computeClosestIndex
public int computeClosestIndex(java.awt.Color referenceColor)
Computes the index of the color which comes closest to the specified color. This may return -1, if there is no sufficiently close color in the color list.
-
setClosestIndex
public void setClosestIndex(int newValue)
Sets the index of the color which is closest to the current color in the color chooser.- Parameters:
newValue- closest index or -1, if no color is close.
-
getClosestIndex
public int getClosestIndex()
Returns the index of the color which is closest to the current color in the color chooser, or -1 of no such color exists.
-
-