|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.jidesoft.combobox.AbstractComboBox com.jidesoft.combobox.ColorComboBox
public class ColorComboBox
ColorComboBox
is a combobox which can be used to choose a Color
.
Nested Class Summary | |
---|---|
class |
ColorComboBox.ColorEditorComponent
The EditorComponent for ColorComboBox. |
class |
ColorComboBox.ColorLabel
The color label component to paint the selected color. |
class |
ColorComboBox.ColorRendererComponent
|
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 |
PROPERTY_COLOR_ICON_VISIBLE
|
static String |
PROPERTY_COLOR_MODE
|
static String |
PROPERTY_COLOR_VALUE_VISIBLE
|
static String |
PROPERTY_SELECTED_COLOR
|
Fields inherited from class com.jidesoft.combobox.AbstractComboBox |
---|
_dialog, _editable, _editor, _listDataListener, _oldSelectedItemReminder, _popupButton, _popupPanel, _renderer, actionCommand, CLIENT_PROPERTY_HIDE_POPUP_ON_LIST_DATA_CHANGED, CLIENT_PROPERTY_TABLE_CELL_EDITOR, CLIENT_PROPERTY_TABLE_CELL_RENDERER, COMMIT, COMMIT_OR_RESET, COMMIT_OR_REVERT, dataModel, DIALOG, DROPDOWN, HIDE_POPUP_KEY, PERSIST, PROPERTY_SELECTED_ITEM, RESET, REVERT, selectedItemReminder |
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 | |
---|---|
ColorComboBox()
Creates a new ColorComboBox using ColorChooserPanel with 40 colors. |
|
ColorComboBox(int palette)
Creates a new ColorComboBox . |
Method Summary | |
---|---|
AbstractComboBox.EditorComponent |
createEditorComponent()
Subclass should implement this method to create the actual editor component. |
PopupPanel |
createPopupComponent()
Creates a ColorChooserPanel as the popup. |
int |
getColorMode()
Gets the color mode of the ColorComboBox. |
Dimension |
getPreferredSize()
|
Color |
getSelectedColor()
Gets selected color. |
boolean |
isAllowDefaultColor()
If the default color button is visible. |
boolean |
isAllowMoreColors()
If the more color button is visible. |
boolean |
isColorIconVisible()
Checks if the color icon is displayed. |
boolean |
isColorValueVisible()
Checks if the color value is displayed. |
boolean |
isCrossBackGroundStyle()
Get the flag if ColorComboBox should still draw a cross in the color label The default value now is false. |
boolean |
isInvalidValueAllowed()
Checks if the invalid value is allowed. |
boolean |
isUseAlphaColorButtons()
Get the flag indicating if the alpha value will change the display of the color buttons in the ColorChoosePanel. |
void |
propertyChange(PropertyChangeEvent evt)
This method is called when the color changes because of navigation keys. |
void |
setAllowDefaultColor(boolean allowDefaultColor)
Sets the visibility of default color button. |
void |
setAllowMoreColors(boolean allowMoreColors)
Sets the visibility of more color button. |
void |
setColorIconVisible(boolean colorIconVisible)
Show or hide the color icon. |
void |
setColorMode(int colorMode)
Sets the color mode of the ColorComboBox. |
void |
setColorValueVisible(boolean colorValueVisible)
Show or hide the color value. |
void |
setCrossBackGroundStyle(boolean crossBackGroundStyle)
Set the flag if ColorComboBox should still draw a cross in the color label The default value now is false. |
void |
setInvalidValueAllowed(boolean invalidValueAllowed)
Sets the flag if the invalid value is allowed to be entered into DateComboBox . |
void |
setSelectedColor(Color color)
Sets selected color. |
void |
setSelectedItem(Object anObject,
boolean fireEvent)
Same as AbstractComboBox.setSelectedItem(Object) except you can choose to fire the ItemEvent or not. |
void |
setUseAlphaColorButtons(boolean useAlphaColorButtons)
Set the flag indicating if the alpha value will change the display of the color buttons in the ColorChoosePanel. |
protected void |
updateColorFromEditorComponent()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_COLOR_MODE
public static final String PROPERTY_SELECTED_COLOR
public static final String PROPERTY_COLOR_VALUE_VISIBLE
public static final String PROPERTY_COLOR_ICON_VISIBLE
Constructor Detail |
---|
public ColorComboBox()
ColorComboBox
using ColorChooserPanel with 40 colors.
public ColorComboBox(int palette)
ColorComboBox
.
palette
- the paletteMethod Detail |
---|
public AbstractComboBox.EditorComponent createEditorComponent()
AbstractComboBox
createEditorComponent
in class AbstractComboBox
public PopupPanel createPopupComponent()
ColorChooserPanel panel = new ColorChooserPanel(getColorMode(), isAllowMoreColors(), isAllowDefaultColor(),
getLocale());
panel.addPropertyChangeListener(ColorChooserPanel.PROPERTY_SELECTED_COLOR, this);
Subclass can override this method to provide your own ColorChooserPanel.
createPopupComponent
in class AbstractComboBox
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
evt
- the PropertyChangeEventpublic int getColorMode()
public void setColorMode(int colorMode)
colorMode
- the valid values for this parameter are ColorChooserPanel.PALETTE_COLOR_15
, ColorChooserPanel.PALETTE_COLOR_40
,ColorChooserPanel.PALETTE_COLOR_216
, ColorChooserPanel.PALETTE_GRAY_16
, ColorChooserPanel.PALETTE_GRAY_102
, and ColorChooserPanel.PALETTE_GRAY_256
. You can also use your customize color palette. In this
case, it's better to override createPopupComponent()
to create your own
ColorChooserPanel.public boolean isAllowDefaultColor()
public void setAllowDefaultColor(boolean allowDefaultColor)
allowDefaultColor
- true if the default color button is visiblepublic boolean isAllowMoreColors()
public void setAllowMoreColors(boolean allowMoreColors)
allowMoreColors
- true if the more color button is visiblepublic Color getSelectedColor()
protected void updateColorFromEditorComponent()
public void setSelectedColor(Color color)
color
- the selected colorpublic void setSelectedItem(Object anObject, boolean fireEvent) throws IllegalArgumentException
AbstractComboBox
AbstractComboBox.setSelectedItem(Object)
except you can choose to fire the ItemEvent or not.
setSelectedItem
in class AbstractComboBox
anObject
- the new valuefireEvent
- true to fire event which is the same as AbstractComboBox.setSelectedItem(Object)
. False if you don't want to fire event.
IllegalArgumentException
public boolean isCrossBackGroundStyle()
public void setCrossBackGroundStyle(boolean crossBackGroundStyle)
crossBackGroundStyle
- true if you want to switch back to the original cross back groundpublic boolean isUseAlphaColorButtons()
public void setUseAlphaColorButtons(boolean useAlphaColorButtons)
useAlphaColorButtons
- the flagpublic Dimension getPreferredSize()
getPreferredSize
in class JComponent
public boolean isColorValueVisible()
public void setColorValueVisible(boolean colorValueVisible)
colorValueVisible
- true if the color value is visiblepublic boolean isColorIconVisible()
public void setColorIconVisible(boolean colorIconVisible)
colorIconVisible
- true if the color value is visiblepublic boolean isInvalidValueAllowed()
public void setInvalidValueAllowed(boolean invalidValueAllowed)
DateComboBox
. If false (the default
value), user must type a valid date string in the correct format. Otherwise, the focus lost or after enter is
pressed, the invalid value will be reset. If true, the invalid string will be kept and set to the combobox using
setSelectedItem. Developer can use getSelectedItem to retrieve the value. getDate or getCalendar will still
return null as the value is not valid.
invalidValueAllowed
- true or false.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |