|
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 javax.swing.JComboBox com.jidesoft.combobox.ExComboBox com.jidesoft.combobox.ColorExComboBox
public class ColorExComboBox
ColorExComboBox
is a combobox which can be used to choose a Color
.
Nested Class Summary | |
---|---|
class |
ColorExComboBox.ColorIcon
The color label component to paint the selected color. |
Nested classes/interfaces inherited from class com.jidesoft.combobox.ExComboBox |
---|
ExComboBox.LazyDelegateAction |
Nested classes/interfaces inherited from class javax.swing.JComboBox |
---|
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager |
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 | |
---|---|
protected ColorExComboBox.ColorIcon |
_colorIcon
|
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.ExComboBox |
---|
CLIENT_PROPERTY_HIDE_POPUP_ON_LIST_DATA_CHANGED, CLIENT_PROPERTY_POPUP_PANEL, CLIENT_PROPERTY_TABLE_CELL_EDITOR, CLIENT_PROPERTY_TABLE_CELL_RENDERER, COMMIT, COMMIT_OR_RESET, COMMIT_OR_REVERT, DIALOG, DOWN_KEY_BEHAVIOR_SELECT_NEXT, DOWN_KEY_BEHAVIOR_SHOW_POPUP, DROPDOWN, PERSIST, PROPERTY_BUTTON_VISIBLE, PROPERTY_SELECTED_ITEM, RESET, REVERT |
Fields inherited from class javax.swing.JComboBox |
---|
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, 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 | |
---|---|
ColorExComboBox()
Creates a new ColorComboBox using ColorChooserPanel with 40 colors. |
|
ColorExComboBox(int palette)
Creates a new ColorComboBox . |
Method Summary | |
---|---|
PopupPanel |
createPopupComponent()
Creates a ColorChooserPanel as the popup. |
void |
customizeRendererComponent(Component rendererComponent,
Object value,
int index,
boolean selected,
boolean cellHasFocus)
|
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. |
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 ExComboBox.setSelectedItem(Object) except you can choose to fire the ItemEvent or not. |
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
protected ColorExComboBox.ColorIcon _colorIcon
Constructor Detail |
---|
public ColorExComboBox()
ColorComboBox
using ColorChooserPanel with 40 colors.
public ColorExComboBox(int palette)
ColorComboBox
.
palette
- the paletteMethod Detail |
---|
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 ExComboBox
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
propertyChange
in class ExComboBox
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
ExComboBox
ExComboBox.setSelectedItem(Object)
except you can choose to fire the ItemEvent or not.
setSelectedItem
in class ExComboBox
anObject
- the new valuefireEvent
- true to fire event which is the same as ExComboBox.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 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.public void customizeRendererComponent(Component rendererComponent, Object value, int index, boolean selected, boolean cellHasFocus)
customizeRendererComponent
in class ExComboBox
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |