Methods Summary |
---|
protected abstract void | buildChooser()Builds a new chooser panel.
|
protected java.awt.Color | getColorFromModel()Returns the color that is currently selected.
return getColorSelectionModel().getSelectedColor();
|
public javax.swing.colorchooser.ColorSelectionModel | getColorSelectionModel()Returns the model that the chooser panel is editing.
return chooser.getSelectionModel();
|
public abstract java.lang.String | getDisplayName()Returns a string containing the display name of the panel.
|
public int | getDisplayedMnemonicIndex()Provides a hint to the look and feel as to the index of the character in
getDisplayName that should be visually identified as the
mnemonic. The look and feel should only use this if
getMnemonic returns a value > 0.
The return value here is a hint, it is ultimately up to the look
and feel to honor the return value in some meaningful way. For example,
a look and feel may wish to render each
AbstractColorChooserPanel in a JTabbedPane ,
and further use this return value to underline a character in
the getDisplayName .
This implementation returns -1, indicating the
AbstractColorChooserPanel does not support a mnemonic,
subclasses wishing a mnemonic will need to override this.
return -1;
|
static int | getInt(java.lang.Object key, int defaultValue)Returns an integer from the defaults table. If key does
not map to a valid Integer , default is
returned.
Object value = UIManager.get(key);
if (value instanceof Integer) {
return ((Integer)value).intValue();
}
if (value instanceof String) {
try {
return Integer.parseInt((String)value);
} catch (NumberFormatException nfe) {}
}
return defaultValue;
|
public abstract javax.swing.Icon | getLargeDisplayIcon()Returns the large display icon for the panel.
|
public int | getMnemonic()Provides a hint to the look and feel as to the
KeyEvent.VK constant that can be used as a mnemonic to
access the panel. A return value <= 0 indicates there is no mnemonic.
The return value here is a hint, it is ultimately up to the look
and feel to honor the return value in some meaningful way.
This implementation returns 0, indicating the
AbstractColorChooserPanel does not support a mnemonic,
subclasses wishing a mnemonic will need to override this.
return 0;
|
public abstract javax.swing.Icon | getSmallDisplayIcon()Returns the small display icon for the panel.
|
public void | installChooserPanel(javax.swing.JColorChooser enclosingChooser)Invoked when the panel is added to the chooser.
If you override this, be sure to call super .
if (chooser != null) {
throw new RuntimeException ("This chooser panel is already installed");
}
chooser = enclosingChooser;
buildChooser();
updateChooser();
colorListener = new ModelListener();
getColorSelectionModel().addChangeListener(colorListener);
|
public void | paint(java.awt.Graphics g)Draws the panel.
if (dirty) {
updateChooser();
dirty = false;
}
super.paint(g);
|
public void | uninstallChooserPanel(javax.swing.JColorChooser enclosingChooser)Invoked when the panel is removed from the chooser.
If override this, be sure to call super .
getColorSelectionModel().removeChangeListener(colorListener);
chooser = null;
|
public abstract void | updateChooser()Invoked automatically when the model's state changes.
It is also called by installChooserPanel to allow
you to set up the initial state of your chooser.
Override this method to update your ChooserPanel .
|