|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectComponent
Container
JComponent
PaletteComboBox
public class PaletteComboBox
A combo box for selecting a color palette. The choices of available palettes is provided by a palette factory given to the constructor.
This combo box can also be used as a cell editor in a JTable,
by invoking the useAsTableCellEditor(TableColumn) method.
| display/geotk-widgets-swing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
PaletteComboBox()
Creates a new combo box using the default palette factory. |
|
PaletteComboBox(PaletteFactory factory)
Creates a new combo box using the given palette factory. |
|
| Method Summary | |
|---|---|
void |
addColor(Color color)
Adds a uniform color (typically opaque) to the list of proposed choices. |
void |
addDefaultColors()
Adds a default set of colors to the list of proposed choices. |
Color[] |
getSelectedColors()
Returns the colors for the currently selected item, or null if none. |
String |
getSelectedItem()
Returns the name of the currently selected item, or null if none. |
void |
setSelectedColors(Color... colors)
Sets the currently selected item by its color. |
void |
setSelectedItem(String name)
Sets the currently selected item by its color code or palette name. |
void |
useAsTableCellEditor(TableColumn column)
Uses this PaletteComboBox as the table cell editor
and the table cell renderer of the given table column. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PaletteComboBox()
public PaletteComboBox(PaletteFactory factory)
factory - The factory to use for loading colors from a palette name, or
null for the default.| Method Detail |
|---|
public void addColor(Color color)
color - The uniform color to add.public void addDefaultColors()
Color class.
public String getSelectedItem()
null if none.
PaletteFactory javadoc.'#' character followed by the hexadecimal code of that color.null.
null if none.public void setSelectedItem(String name)
null, then the "none" choice is
selected.'#' character, then the
name is decoded as a color using the Color.decode(String) method
and the corresponding color is selected.
If no color or palette is found for the given name, then this method selects
the "none" choice (same as if the name is null).
name - The color code or palette name to select, or null if none.public Color[] getSelectedColors()
null if none.
null if none.public void setSelectedColors(Color... colors)
colors - The colors to select, or null if none.public void useAsTableCellEditor(TableColumn column)
PaletteComboBox as the table cell editor
and the table cell renderer of the given table column.
This PaletteComboBox instance should not be used for any other purpose after
this method call.
column - The table column on which to set this combo box as the editor and renderer.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||