public class JComboBoxConfigurableLookUp extends JComboBox implements Serializable
A configurable combo box component that lists items that carry out with the criterions of a ILookUp agent,
considering the text in its inner editor.
Key features:
DefaultComboBoxConfigurableLookUpModel as a dataModel, which it's also configurable.Configuration flags:
ILookUp agent, or uses always black color.ILookUp agent, or not.ILookUp agent, or uses the default (JComboBox and more) behaviour.DefaultComboBoxConfigurableLookUpModel.showAllItemsInListBox == false); otherwise, if this flag isn't enabled,
won't display all items in that situation.Default flag values are:
More information about the behaviour of it's dataModel in DefaultComboBoxConfigurableLookUpModel .
| Modifier and Type | Class and Description |
|---|---|
class |
JComboBoxConfigurableLookUp.PlainDocumentTextFormatter
Inner class that inherits of the class PlainDocument, and is used for manipulate the textWritten that has the document of the editor of this component.
|
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManagerJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_BEEP_ENABLED_CONFIGURATION |
static boolean |
DEFAULT_COMPLETE_ARROW_KEY_SELECTION_CONFIGURATION |
static boolean |
DEFAULT_DISPLAY_ALL_ITEMS_WITH_ARROW_BUTTON_CONFIGURATION |
static boolean |
DEFAULT_HIDE_POPUP_IF_THERE_ARE_NO_ITEMS_CONFIGURATION |
static boolean |
DEFAULT_ONLY_ONE_COLOR_ON_TEXT_CONFIGURATION |
static boolean |
DEFAULT_TO_FORCE_SELECT_AN_ITEM_CONFIGURATION |
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminderaccessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JComboBoxConfigurableLookUp()
Default constructor without parameters.
|
JComboBoxConfigurableLookUp(DefaultComboBoxConfigurableLookUpModel aModel)
Default constructor with a
DefaultComboBoxConfigurableLookUpModel as parameter. |
JComboBoxConfigurableLookUp(Object[] items)
Default constructor with an array of objects as parameter.
|
JComboBoxConfigurableLookUp(Vector<Object> items)
Default constructor with a Vector of objects as parameter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Object anObject) |
protected void |
configure()
Configures the component and some of its elements.
|
protected void |
configureDocument()
Configures the document of the editor of this component.
|
protected void |
configureEditor(ComboBoxEditor newEditor)
Configures the editor (
ComboBoxEditor ) of this component. |
protected void |
configurePopUp(JComboBoxConfigurableLookUp comboBox)
Configures the popup of this component.
|
protected JComboBox.KeySelectionManager |
createDefaultKeySelectionManager() |
MouseListener |
getArrowMouseListener()
Returns the listener invoked when user presses the arrow button of this
JComboBox. |
protected void |
initialize()
This method sets the start values of inner attributes and creates the necessary inner objects.
|
boolean |
isBeepEnabled()
Returns the 'beep_Enabled' configuration value of this component.
|
boolean |
isBlockPopupHided()
Determines if the popup of this component will always remain hided.
|
boolean |
isCompleteArrowKeySelection()
Returns the 'completeArrowKeySelection' configuration value of this component.
|
boolean |
isDisplayAllItemsWithArrowButton()
Returns the 'displayAllItemsWithArrowButton' configuration value of this component.
|
boolean |
isHidePopupIfThereAreNoItems()
Returns the 'hidePopupIfThereAreNoItems' configuration value of this component.
|
boolean |
isOnlyOneColorOnText()
Returns the 'only_One_Color_On_Text' configuration value of this component.
|
boolean |
isToForceSelectAnItem()
Returns the 'toForceSelectAnItem' configuration value of this component.
|
protected String |
paramString() |
void |
processKeyEvent(KeyEvent e) |
void |
removeAllItems() |
void |
removeItem(Object anObject) |
void |
removeItemAt(int anIndex) |
boolean |
selectWithKeyChar(char keyChar) |
void |
setBeepEnabled(boolean b)
Sets the 'beep_Enabled' configuration value for this component.
|
void |
setBlockPopupHided(boolean b)
Sets if the popup of this component will always remain hided, or can be shown when is invoked.
|
void |
setCompleteArrowKeySelection(boolean b)
Sets the 'completeArrowKeySelection' configuration value for this component.
|
protected void |
setDefaultBehaviorFlagsConfiguration()
Sets the default values of the flags.
|
void |
setDisplayAllItemsWithArrowButton(boolean b)
Sets the 'toForceSelectAnItem' configuration value for this component.
|
void |
setEditable(boolean b) |
void |
setEditor(ComboBoxEditor anEditor)
Sets the editor used to paint and edit the selected item in the
JComboBox field. |
void |
setHidePopupIfThereAreNoItems(boolean b)
Sets the 'hidePopupIfThereAreNoItems' configuration value for this component.
|
void |
setModel(ComboBoxModel aModel) |
void |
setOnlyOneColorOnText(boolean b)
Sets the 'only_One_Color_On_Text' configuration value for this component.
|
void |
setSelectedIndex(int anIndex) |
void |
setSelectedItem(Object anObject) |
void |
setToForceSelectAnItem(boolean b)
Sets the 'toForceSelectAnItem' configuration value for this component.
|
protected void |
setUI(ComponentUI newUI) |
void |
showPopup() |
void |
updateUI() |
actionPerformed, actionPropertyChanged, addActionListener, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, removeActionListener, removeItemListener, removePopupMenuListener, selectedItemChanged, setAction, setActionCommand, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setPopupVisible, setPrototypeDisplayValue, setRenderer, setUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final boolean DEFAULT_ONLY_ONE_COLOR_ON_TEXT_CONFIGURATION
public static final boolean DEFAULT_BEEP_ENABLED_CONFIGURATION
public static final boolean DEFAULT_HIDE_POPUP_IF_THERE_ARE_NO_ITEMS_CONFIGURATION
public static final boolean DEFAULT_TO_FORCE_SELECT_AN_ITEM_CONFIGURATION
public static final boolean DEFAULT_COMPLETE_ARROW_KEY_SELECTION_CONFIGURATION
public static final boolean DEFAULT_DISPLAY_ALL_ITEMS_WITH_ARROW_BUTTON_CONFIGURATION
public JComboBoxConfigurableLookUp()
Default constructor without parameters.
public JComboBoxConfigurableLookUp(DefaultComboBoxConfigurableLookUpModel aModel)
Default constructor with a DefaultComboBoxConfigurableLookUpModel as parameter.
aModel - javax.swing.ComboBoxModelpublic JComboBoxConfigurableLookUp(Object[] items)
Default constructor with an array of objects as parameter.
items - An array of objects. All them must implement a 'String toStrin()' methodprotected void initialize()
This method sets the start values of inner attributes and creates the necessary inner objects.
dataModel - dataModel used by this combo box instanceprotected void configure()
Configures the component and some of its elements.
protected void configureEditor(ComboBoxEditor newEditor)
Configures the editor ( ComboBoxEditor ) of this component.
newEditor - The new editor to configureprotected void configureDocument()
Configures the document of the editor of this component.
protected void configurePopUp(JComboBoxConfigurableLookUp comboBox)
Configures the popup of this component.
comboBox - A reference of this componentpublic MouseListener getArrowMouseListener()
Returns the listener invoked when user presses the arrow button of this JComboBox.
protected void setDefaultBehaviorFlagsConfiguration()
Sets the default values of the flags.
public void setEditor(ComboBoxEditor anEditor)
Sets the editor used to paint and edit the selected item in the
JComboBox field. The editor is used only if the
receiving JComboBox is editable. If not editable,
the combo box uses the renderer to paint the selected item.
The editor must be a JTextComponent, and its document a PlainDocument object.
setEditor in class JComboBoxanEditor - the ComboBoxEditor that
displays the selected itemJComboBox.setRenderer(javax.swing.ListCellRenderer<? super E>)public void setModel(ComboBoxModel aModel)
public void setSelectedIndex(int anIndex)
setSelectedIndex in class JComboBoxpublic void setSelectedItem(Object anObject)
setSelectedItem in class JComboBoxpublic void setEditable(boolean b)
setEditable in class JComboBoxpublic void removeAllItems()
removeAllItems in class JComboBoxpublic void removeItem(Object anObject)
removeItem in class JComboBoxpublic void removeItemAt(int anIndex)
removeItemAt in class JComboBoxprotected void setUI(ComponentUI newUI)
setUI in class JComponentpublic boolean selectWithKeyChar(char keyChar)
selectWithKeyChar in class JComboBoxpublic void processKeyEvent(KeyEvent e)
processKeyEvent in class JComboBoxprotected JComboBox.KeySelectionManager createDefaultKeySelectionManager()
createDefaultKeySelectionManager in class JComboBoxprotected String paramString()
paramString in class JComboBoxpublic void setBlockPopupHided(boolean b)
Sets if the popup of this component will always remain hided, or can be shown when is invoked.
b - true if will remain blocked; false if can be shownpublic boolean isBlockPopupHided()
Determines if the popup of this component will always remain hided.
b - true if will remain blocked; false if can be shownpublic boolean isOnlyOneColorOnText()
Returns the 'only_One_Color_On_Text' configuration value of this component. Configuration values are:
ILookUp agent, text will be on red colour.public void setOnlyOneColorOnText(boolean b)
Sets the 'only_One_Color_On_Text' configuration value for this component. Configuration values are:
ILookUp agent, text will be on red colour.b - value for 'only_One_Color_On_Text' configuration flagpublic boolean isBeepEnabled()
Returns the 'beep_Enabled' configuration value of this component. Configuration values are:
ILookUp agent.public void setBeepEnabled(boolean b)
Sets the 'beep_Enabled' configuration value for this component. Configuration values are:
ILookUp agent.b - value for 'beep_Enabled' configuration flagpublic boolean isHidePopupIfThereAreNoItems()
Returns the 'hidePopupIfThereAreNoItems' configuration value of this component. Configuration values are:
public void setHidePopupIfThereAreNoItems(boolean b)
Sets the 'hidePopupIfThereAreNoItems' configuration value for this component. Configuration values are:
b - value for 'hidePopupIfThereAreNoItems' configuration flagpublic boolean isToForceSelectAnItem()
Returns the 'toForceSelectAnItem' configuration value of this component. Configuration values are:
public void setToForceSelectAnItem(boolean b)
Sets the 'toForceSelectAnItem' configuration value for this component. Configuration values are:
value - for 'toForceSelectAnItem' configuration flagpublic boolean isCompleteArrowKeySelection()
Returns the 'completeArrowKeySelection' configuration value of this component. Configuration values are:
public void setCompleteArrowKeySelection(boolean b)
Sets the 'completeArrowKeySelection' configuration value for this component. Configuration values are:
b - value for 'completeArrowKeySelection' configuration flagpublic boolean isDisplayAllItemsWithArrowButton()
Returns the 'displayAllItemsWithArrowButton' configuration value of this component. Configuration values are:
DefaultComboBoxConfigurableLookUpModel.showAllItemsInListBox == false).public void setDisplayAllItemsWithArrowButton(boolean b)
Sets the 'toForceSelectAnItem' configuration value for this component. Configuration values are:
DefaultComboBoxConfigurableLookUpModel.showAllItemsInListBox == false).value - for 'displayAllItemsWithArrowButton' configuration flag