BasicComboBoxEditor (Java SE 15 & JDK 15)
Description: declaration: module: java.desktop, package: javax.swing.plaf.basic, class: BasicComboBoxEditor
Keywords: javax.swing.plaf.basic.BasicComboBoxEditor class

Module java.desktop
Package javax.swing.plaf.basic

# Class BasicComboBoxEditor

java.lang.Object
javax.swing.plaf.basic.BasicComboBoxEditor

All Implemented Interfaces:
  `FocusListener`, `EventListener`, `ComboBoxEditor`

Direct Known Subclasses:
  `BasicComboBoxEditor.UIResource`, `MetalComboBoxEditor`

    public class BasicComboBoxEditor
    extends Object
    implements ComboBoxEditor, FocusListener

The default editor for editable combo boxes. The editor is implemented as a JTextField.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `BasicComboBoxEditor.UIResource` | A subclass of BasicComboBoxEditor that implements UIResource.

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `protected JTextField` | `editor` | An instance of `JTextField`.

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `BasicComboBoxEditor()` | Constructs a new instance of `BasicComboBoxEditor`.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `protected JTextField` | `createEditorComponent()` | Creates the internal editor component.
  `void` | `setItem​(Object anObject)` | Sets the item that should be edited.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods declared in interface javax.swing.ComboBoxEditor

  `addActionListener, getEditorComponent, getItem, removeActionListener, selectAll`

  ### Methods declared in interface java.awt.event.FocusListener

  `focusGained, focusLost`

- ## Field Details

  - ### editor

    protected JTextField editor
    An instance of `JTextField`.

- ## Constructor Details

  - ### BasicComboBoxEditor

    public BasicComboBoxEditor()
    Constructs a new instance of `BasicComboBoxEditor`.

- ## Method Details

  - ### createEditorComponent

    protected JTextField createEditorComponent()
    Creates the internal editor component. Override this to provide a custom implementation.
    Returns:
      a new editor component
    Since:
      1.6

  - ### setItem

    public void setItem​(Object anObject)
    Sets the item that should be edited.
    Specified by:
      `setItem` in interface `ComboBoxEditor`
    Parameters:
      `anObject` - the displayed value of the editor