# com.bea.ide.ui.propertyeditor.editors
ComboBoxPropertyEditor Class

public class ComboBoxPropertyEditor
extends `JComboBox`
implements `FocusListener`, `IPropertyEditor`

A simple property editor which displays property values in the form of a drop down list box and a text area which can be set to be editable.

Hierarchy
  `Object`
  `Component`
  `Container`
  `JComponent`
  `JComboBox`
  `ComboBoxPropertyEditor`

All Implemented Interfaces
  `Accessible`, `ActionListener`, `EventListener`, `FocusListener`, `ImageObserver`, `IPropertyEditor`, `ItemSelectable`, `ListDataListener`, `MenuContainer`, `Serializable`

Direct Known Subclasses
  `BooleanPropertyEditor`

## Nested Class Summary

Nested classes from javax.swing`.`JComboBox``
``JComboBox.AccessibleJComboBox`, `JComboBox.KeySelectionManager``

Nested classes from javax.swing`.`JComponent``
``JComponent.AccessibleJComponent``

Nested classes from java.awt`.`Container``
``Container.AccessibleAWTContainer``

Nested classes from java.awt`.`Component``
``Component.AccessibleAWTComponent`, `Component.BltBufferStrategy`, `Component.FlipBufferStrategy``

## Field Summary

Fields from javax.swing`.`JComboBox``
`actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder`

Fields from javax.swing`.`JComponent``
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields from java.awt`.`Component``
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields from interface java.awt.image`.`ImageObserver``
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

## Constructor Summary

ComboBoxPropertyEditor(`IProperty` property, boolean isTextFieldEditable, `List` allowedValues, int maxRowCount)
ComboBoxPropertyEditor(`IProperty` property, boolean isTextFieldEditable, `List` allowedValues)

## Method Summary

`public void` | `activate`(`FocusListener` l) Adds the focus listener to all focusable components in its display.
`public void` | `deactivate`(`FocusListener` l) Removes the listener from any focusable components that the listener was added to in addFocusListener.
`public void` | `focusGained`(`FocusEvent` e) Invoked when the text field gains the keyboard focus.
`public void` | `focusLost`(`FocusEvent` e) Invoked when the text field loses the keyboard focus.
`public `Component`` | `getComponent`() Returns the component which will be placed in the property view for display and editing of the property value.
`public `IProperty`` | `getProperty`() Returns the IProperty whose value this editor displays.
`public `String`` | `getToolTipText`(`MouseEvent` e) Gets the tooltip text for this editor.
`public `String`` | `getUIClassID`() Returns the name of the L&F class that renders this component.
`protected boolean` | `restoreValue`() Restores the editor's value to the current value of the property.
`public boolean` | `setFocused`() Called by the property view when this property editor should request focus to a component in its display.
`protected void` | `writeValue`() Writes the editor value to the property contained in this editor.

Methods from `javax.swing.`JComboBox``
`actionPerformed, 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, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, 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, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, updateUI`

Methods from `javax.swing.`JComponent``
`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

Methods from `java.awt.`Container``
`add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree`

Methods from `java.awt.`Component``
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.accessibility.`Accessible``
`getAccessibleContext`

Methods from interface `java.awt.event.`ActionListener``
`actionPerformed`

Methods from interface `java.awt.event.`FocusListener``
`focusGained, focusLost`

Methods from interface `java.awt.image.`ImageObserver``
`imageUpdate`

Methods from interface `com.bea.ide.ui.propertyeditor.`IPropertyEditor``
``activate`, `deactivate`, `getComponent`, `getProperty`, `setFocused``

Methods from interface `java.awt.`ItemSelectable``
`addItemListener, getSelectedObjects, removeItemListener`

Methods from interface `javax.swing.event.`ListDataListener``
`contentsChanged, intervalAdded, intervalRemoved`

Methods from interface `java.awt.`MenuContainer``
`getFont, postEvent, remove`

## Constructor Detail

### ComboBoxPropertyEditor

    public ComboBoxPropertyEditor(IProperty property,
                                  boolean isTextFieldEditable,
                                  List allowedValues,
                                  int maxRowCount)

### ComboBoxPropertyEditor

    public ComboBoxPropertyEditor(IProperty property,
                                  boolean isTextFieldEditable,
                                  List allowedValues)

## Method Detail

### activate(FocusListener) Method

    public void activate(FocusListener l)

Adds the focus listener to all focusable components in its display. The property view will update its selection highlighting for this property based on the focus gain and loss events received by this listener.

Note that if the property editor uses popup windows, it may need to add this focus listener to any focusable components in the popup window.

#### Parameters

l
  the focus listener

Related Topics

``FocusListener``

### deactivate(FocusListener) Method

    public void deactivate(FocusListener l)

Removes the listener from any focusable components that the listener was added to in addFocusListener.

#### Parameters

l
  the focus listener

Related Topics

``FocusListener``

### focusGained(FocusEvent) Method

    public void focusGained(FocusEvent e)

Invoked when the text field gains the keyboard focus.

### focusLost(FocusEvent) Method

    public void focusLost(FocusEvent e)

Invoked when the text field loses the keyboard focus.

### getComponent() Method

    public Component getComponent()

Returns the component which will be placed in the property view for display and editing of the property value.

The property view will call requestFocus on this component when it should take focus and display in edit mode.

#### Returns

Component

### getProperty() Method

    public IProperty getProperty()

Returns the IProperty whose value this editor displays.

#### Returns

IProperty

### getToolTipText(MouseEvent) Method

    public String getToolTipText(MouseEvent e)

Gets the tooltip text for this editor.

Overrides
  `JComponent.getToolTipText(MouseEvent)`

### getUIClassID() Method

    public String getUIClassID()

Returns the name of the L&F class that renders this component.

Overrides
  `JComboBox.getUIClassID()`

#### Returns

the string "ComboBoxUI"

Related Topics

``JComponent.getUIClassID()``
``UIDefaults.getUI(JComponent)``

### restoreValue() Method

    protected boolean restoreValue()

Restores the editor's value to the current value of the property.

#### Returns

true if the operation was successful, false otherwise.

### setFocused() Method

    public boolean setFocused()

Called by the property view when this property editor should request focus to a component in its display.

Return value should reflect whether the focus request is guaranteed to fail or is likely to succeed. If the property editor already has focus, return true (note that this differs from the behavior of the Component and JComponent request focus methods which return false if the component already has focus).

Use of Component/JComponent.requestFocus(boolean temporary) is recommended (despite swing/awt java doc to the contrary). It is the only focus request method that both gives a return value, and will change active windows if necessary.

#### Returns

`false` if the focus request is guaranteed to fail; `true` if it is likely to succeed

### writeValue() Method

    protected void writeValue()

Writes the editor value to the property contained in this editor.