|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.neu.ccs.gui.SwatchNameRenderer
Class SwatchNameRenderer is designed to implement
ListCellRenderer by providing pairs each with a
paint swatch and its name.
| Constructor Summary | |
SwatchNameRenderer()
This constructor provides a renderer for swatch-name pairs generated from the color names obtained via Colors.getColorNamesAsArray. |
|
| Method Summary | |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Returns the swatch name pair component associated with the given String value in the given list; sets the
foreground and background of the swatch name pair depending
on the given isSelected parameter. |
Dimension |
getMaximumPreferredSize()
Returns the maximum preferred size of all swatch-name pairs in this renderer. |
String[] |
getStrings()
Returns the array of color name strings installed in this renderer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SwatchNameRenderer()
| Method Detail |
public String[] getStrings()
Returns the array of color name strings installed in this renderer. This returns the strings installed at construction and avoids problems if additional color name pairs are later installed globally.
public Dimension getMaximumPreferredSize()
Returns the maximum preferred size of all swatch-name pairs in this renderer.
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Returns the swatch name pair component associated with the
given String value in the given list; sets the
foreground and background of the swatch name pair depending
on the given isSelected parameter.
This method implements the ListCellRenderer
interface.
Returns null if an unexpected error occurs.
getListCellRendererComponent in interface ListCellRendererlist - the JList to paintvalue - the value returned by list.getModel().getElementAt(index)index - the index of the cellisSelected - true if the specified cell was selectedcellHasFocus - true if the specified cell has the focus
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||