Package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser

# Class PaletteListModel

java.lang.Object
javax.swing.AbstractListModel
org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser.PaletteListModel

All Implemented Interfaces:
  `Serializable`, `ListModel`

public class PaletteListModel extends AbstractListModel
PaletteListModel manages a list of PaletteEntry.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class javax.swing.AbstractListModel

`listenerList`

## Constructor Summary

Constructors
Constructor
Description
`PaletteListModel(String name, String info, PaletteEntry[] entries)`
Creates a new instance.

## Method Summary

Modifier and Type
Method
Description
`int`
`computeClosestIndex(Color referenceColor)`
Computes the index of the color which comes closest to the specified color.
`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.
`Object`
`getElementAt(int index)`
`String`
`getInfo()`
`String`
`getName()`
`int`
`getSize()`
`void`
`setClosestIndex(int newValue)`
Sets the index of the color which is closest to the current color in the color chooser.
`void`
`setInfo(String newValue)`
`void`
`setName(String newValue)`
`String`
`toString()`
Used for displaying the name of the palette in the combo box of the ColorPalettesChooser.

### Methods inherited from class javax.swing.AbstractListModel

`addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### PaletteListModel

public PaletteListModel(String name, String info, PaletteEntry[] entries)
Creates a new instance.

## Method Details

### setName

public void setName(String newValue)

### getName

public String getName()

### setInfo

public void setInfo(String newValue)

### getInfo

public String getInfo()

### getElementAt

public Object getElementAt(int index)

### getSize

public int getSize()

### toString

public String toString()
Used for displaying the name of the palette in the combo box of the ColorPalettesChooser.

Overrides:
  `toString` in class `Object`

### computeClosestIndex

public int computeClosestIndex(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.