|
||||||||||
| 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.JComboBox
org.jdesktop.swingx.JXComboBox
public class JXComboBox
An enhanced JComboBox that provides the following additional functionality:
Auto-starts edits correctly for AutoCompletion when inside a JTable. A normal JComboBox fails to recognize the first key stroke when it has been
decorated.
Adds highlighting support.
| Nested Class Summary | |
|---|---|
protected static class |
JXComboBox.ComboBoxAdapter
|
class |
JXComboBox.DelegatingRenderer
A decorator for the original ListCellRenderer. |
| Nested classes/interfaces inherited from class javax.swing.JComboBox |
|---|
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 | |
|---|---|
JXComboBox()
Creates a JXComboBox with a default data model. |
|
JXComboBox(javax.swing.ComboBoxModel model)
Creates a JXComboBox that takes its items from an existing
ComboBoxModel. |
|
JXComboBox(java.lang.Object[] items)
Creates a JXComboBox that contains the elements in the specified array. |
|
JXComboBox(java.util.Vector<?> items)
Creates a JXComboBox that contains the elements in the specified Vector. |
|
| Method Summary | |
|---|---|
void |
addHighlighter(Highlighter highlighter)
Adds a Highlighter. |
protected javax.swing.ListCellRenderer |
createDefaultCellRenderer()
Creates and returns the default cell renderer to use. |
protected javax.swing.event.ChangeListener |
createHighlighterChangeListener()
Creates and returns the ChangeListener observing Highlighters. |
protected ComponentAdapter |
getComponentAdapter()
|
protected ComponentAdapter |
getComponentAdapter(int index)
Convenience to access a configured ComponentAdapter. |
protected javax.swing.event.ChangeListener |
getHighlighterChangeListener()
Returns the ChangeListener to use with highlighters. |
Highlighter[] |
getHighlighters()
Returns the Highlighters used by this column. |
protected static javax.swing.JList |
getPopupListFor(javax.swing.JComboBox comboBox)
|
javax.swing.ListCellRenderer |
getRenderer()
|
javax.swing.ListCellRenderer |
getWrappedRenderer()
Returns the renderer installed by client code or the default if none has been set. |
boolean |
isUseHighlightersForCurrentValue()
|
protected boolean |
processKeyBinding(javax.swing.KeyStroke ks,
java.awt.event.KeyEvent e,
int condition,
boolean pressed)
|
void |
removeHighlighter(Highlighter highlighter)
Removes the given Highlighter. |
void |
setHighlighters(Highlighter... highlighters)
Sets the Highlighters to the column, replacing any old settings. |
void |
setRenderer(javax.swing.ListCellRenderer renderer)
|
void |
setUseHighlightersForCurrentValue(boolean useHighlightersForCurrentValue)
|
void |
updateUI()
|
| Methods inherited from class javax.swing.JComboBox |
|---|
actionPerformed, actionPropertyChanged, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setSelectedIndex, setSelectedItem, setUI, showPopup |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, 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, hide, 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, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JXComboBox()
JXComboBox with a default data model. The default data model is an
empty list of objects. Use addItem to add items. By default the first item in
the data model becomes selected.
DefaultComboBoxModelpublic JXComboBox(javax.swing.ComboBoxModel model)
JXComboBox that takes its items from an existing
ComboBoxModel. Since the ComboBoxModel is provided, a combo box
created using this constructor does not create a default combo box model and may impact how
the insert, remove and add methods behave.
model - the ComboBoxModel that provides the displayed list of itemsDefaultComboBoxModelpublic JXComboBox(java.lang.Object[] items)
JXComboBox that contains the elements in the specified array. By
default the first item in the array (and therefore the data model) becomes selected.
items - an array of objects to insert into the combo boxDefaultComboBoxModelpublic JXComboBox(java.util.Vector<?> items)
JXComboBox that contains the elements in the specified Vector. By
default the first item in the vector (and therefore the data model) becomes selected.
items - an array of vectors to insert into the combo boxDefaultComboBoxModel| Method Detail |
|---|
protected static javax.swing.JList getPopupListFor(javax.swing.JComboBox comboBox)
protected boolean processKeyBinding(javax.swing.KeyStroke ks,
java.awt.event.KeyEvent e,
int condition,
boolean pressed)
processKeyBinding in class javax.swing.JComponentprotected ComponentAdapter getComponentAdapter()
protected ComponentAdapter getComponentAdapter(int index)
index - the row index in view coordinates, must be valid.
protected javax.swing.ListCellRenderer createDefaultCellRenderer()
DefaultListRenderer.
public javax.swing.ListCellRenderer getRenderer()
Overridden to return the delegating renderer which is wrapped around the original to support highlighting. The returned renderer is of type DelegatingRenderer and guaranteed to not-null
getRenderer in class javax.swing.JComboBoxsetRenderer(ListCellRenderer),
JXComboBox.DelegatingRendererpublic javax.swing.ListCellRenderer getWrappedRenderer()
#setCellRenderer(TreeCellRenderer)public void setRenderer(javax.swing.ListCellRenderer renderer)
Overridden to wrap the given renderer in a DelegatingRenderer to support highlighting.
Note: the wrapping implies that the renderer returned from the getCellRenderer
is not the renderer as given here, but the wrapper. To access the original,
use getWrappedCellRenderer.
setRenderer in class javax.swing.JComboBox#getWrappedCellRenderer(),
#getCellRenderer()public boolean isUseHighlightersForCurrentValue()
public void setUseHighlightersForCurrentValue(boolean useHighlightersForCurrentValue)
public void setHighlighters(Highlighter... highlighters)
Highlighters to the column, replacing any old settings. None of the
given Highlighters must be null.
highlighters - zero or more not null highlighters to use for renderer decoration.getHighlighters(),
addHighlighter(Highlighter),
removeHighlighter(Highlighter)public Highlighter[] getHighlighters()
Highlighters used by this column. Maybe empty, but guarantees to be
never null.
setHighlighters(Highlighter[])public void addHighlighter(Highlighter highlighter)
highlighter - the Highlighter to add.
java.lang.NullPointerException - if Highlighter is null.removeHighlighter(Highlighter),
setHighlighters(Highlighter[])public void removeHighlighter(Highlighter highlighter)
Does nothing if the Highlighter is not contained.
highlighter - the Highlighter to remove.addHighlighter(Highlighter),
setHighlighters(Highlighter...)protected javax.swing.event.ChangeListener getHighlighterChangeListener()
ChangeListener to use with highlighters. Lazily creates the
listener.
not-nullprotected javax.swing.event.ChangeListener createHighlighterChangeListener()
A property change event is create for a state change.
public void updateUI()
Overridden to update renderer and highlighters.
updateUI in class javax.swing.JComboBox
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||