|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.princeton.toy.choosers.TColorChooserPane
public class TColorChooserPane
TColorChooserPane manages a set of colors for various indices and allows the user to change the colors for those indices. It also offers a disabled option which generally tells the index not to use that color (how that is done will be implementation dependant).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
CHANGE_COMMAND
The command that causes the TColorChooserPane to open a color chooser dialog. |
static String |
UPDATE_COMMAND
The command that causes the TColorChooserPane to update its components with the internal data. |
Fields inherited from class javax.swing.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 java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TColorChooserPane(String[] colorNames,
String[] disabledDescriptions)
Creates a new TColorChooserPane. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Implement ActionListener to pay attention to changes in the disabledCheckbox and changeButton. |
boolean |
doCommand(String command,
Object extraInfo)
Performs a command based on the argument. |
Color |
getColor(int index)
Gets the color for a given index. |
boolean |
isDisabled(int index)
Returns wheter or not the color for a given index should be used. |
void |
setColor(Color color,
int index)
Sets the color for a given index. |
void |
setDisabled(boolean disabled,
int index)
Sets the disabled state for a given index. |
void |
valueChanged(ListSelectionEvent e)
Implement ListSelectionListener to pay attention to changes in the colorList. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String UPDATE_COMMAND
public static final String CHANGE_COMMAND
Constructor Detail |
---|
public TColorChooserPane(String[] colorNames, String[] disabledDescriptions)
Method Detail |
---|
public Color getColor(int index)
index
- The index of the requested color. An invalid value will result in an
ArrayIndexOutOfBoundsException.
public void setColor(Color color, int index)
color
- The new color for the given index. A null value will result in a
NullPointerException.index
- The index of the color we're setting. An invalid value will result in an
ArrayIndexOutOfBoundsException.public boolean isDisabled(int index)
index
- The index of the requested disabled state. An invalid value will result in an
ArrayIndexOutOfBoundsException.
public void setDisabled(boolean disabled, int index)
disabled
- The new disabled state for the given index.index
- The index of the disabled state we're setting. An invalid value will result in
an ArrayIndexOutOfBoundsException.public boolean doCommand(String command, Object extraInfo)
command
- A string representing the command. Note that pointer equality (not string
equality) is tested here, so it is important to use the string constants defined in this
class. An IllegalArgumentException will be thrown if the argument is invalid.
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |