Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## contrib.ch.randelshofer.quaqua.colorchooser
Class PaletteListModel

    java.lang.Object
      javax.swing.AbstractListModel
          contrib.ch.randelshofer.quaqua.colorchooser.PaletteListModel

All Implemented Interfaces:
  java.io.Serializable, javax.swing.ListModel

    public class PaletteListModel

extends javax.swing.AbstractListModel

PaletteListModel manages a list of PaletteEntry.

Version:
  1.0 19 septembre 2005 Created.
Author:
  Werner Randelshofer
See Also:
  Serialized Form

Field Summary

Fields inherited from class javax.swing.AbstractListModel
`listenerList`

Constructor Summary
`PaletteListModel(java.lang.String name, java.lang.String info, PaletteEntry[] entries)` Creates a new instance.

Method Summary
`int` | `computeClosestIndex(java.awt.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.
`java.lang.Object` | `getElementAt(int index)`
`java.lang.String` | `getInfo()`
`java.lang.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(java.lang.String newValue)`
`void` | `setName(java.lang.String newValue)`
`java.lang.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 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:
    `toString` in class `java.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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD