The combo box is a compound component which means that it is an aggregate of many simpler components. This class creates and manages the listeners on the combo box and the combo box model. These listeners update the user interface in response to changes in the properties and state of the combo box.
All event handling is handled by listener classes created with the
createxxxListener() methods and internal classes.
You can change the behavior of this class by overriding the
createxxxListener() methods and supplying your own
event listeners or subclassing from the ones supplied in this class.
For adding specific actions,
override installKeyboardActions to add actions in response to
KeyStroke bindings. See the article How to Use Key Bindings
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public class | BasicComboBoxUI.
This layout manager handles the 'standard' layout of combo boxes. |
| pack-priv class | |
| public class | BasicComboBoxUI.
This listener hides the popup when the focus is lost. |
| private class | |
| public class | BasicComboBoxUI.
This listener watches for changes to the selection in the combo box. |
| public class | BasicComboBoxUI.
This listener checks to see if the key event isn't a navigation key. |
| public class | BasicComboBoxUI.
This listener watches for changes in the
|
| public class | BasicComboBoxUI.
This listener watches for bound properties that have changed in the combo box. |
| Modifier and Type | Field and Description |
|---|---|
| protected JButton | arrowButton
The arrow button that invokes the popup. |
| private Dimension | |
| protected Dimension | cachedMinimumSize
The cached minimum preferred size. |
| private static final ListCellRenderer | |
| protected JComboBox | comboBox
The instance of |
| protected CellRendererPane | currentValuePane
Used to render the currently selected item in the combo box. |
| protected Component | editor
The Component that the |
| protected FocusListener | focusListener
This protected field is implementation specific. |
| private BasicComboBoxUI. | handler
Implements all the Listeners needed by this class, all existing listeners redirect to it. |
| protected boolean | hasFocus
This protected field is implementation specific. |
| pack-priv static final StringBuffer | |
| private static final String | |
| private boolean | |
| protected boolean | isMinimumSizeDirty
The flag for recalculating the minimum preferred size. |
| private boolean | |
| protected ItemListener | itemListener
This protected field is implementation specific. |
| protected KeyListener | keyListener
This protected field is implementation specific. |
| pack-priv JComboBox. | keySelectionManager
The default key selection manager |
| private long | lastTime
This is tricky, this variables is needed for DefaultKeySelectionManager to take into account time factor. |
| protected JList | listBox
This list is for drawing the current item in the combo box. |
| protected ListDataListener | listDataListener
This protected field is implementation specific. |
| protected Insets | padding
If specified, these insets act as padding around the cell renderer when laying out and painting the "selected" item in the combo box. |
| protected ComboPopup | popup
The implementation of |
| protected KeyListener | popupKeyListener
The |
| protected MouseListener | popupMouseListener
The |
| protected MouseMotionListener | popupMouseMotionListener
The |
| protected PropertyChangeListener | propertyChangeListener
This protected field is implementation specific. |
| private boolean | sameBaseline
Whether or not all cells have the same baseline. |
| protected boolean | squareButton
Indicates whether or not the combo box button should be square. |
| private long | |
| private long | timeFactor
The time factor to treat the series of typed alphanumeric key as prefix for first letter navigation. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| protected void | |
| protected JButton | Returns: a button which represents the popup controlCreates a button which will be used as the control to show or hide the popup portion of the combo box. |
| protected ComboBoxEditor | Returns: aComboBoxEditor used for the combo boxCreates the default editor that will be used in editable combo boxes. |
| protected FocusListener | Returns: an instance of aFocusListener or nullCreates a |
| protected ItemListener | Returns: an instance of anItemListener or nullCreates an |
| protected KeyListener | Returns: an instanceKeyListener or nullCreates a |
| protected LayoutManager | Returns: an instance of a layout managerCreates a layout manager for managing the components which make up the combo box. |
| protected ListDataListener | Returns: an instance of aListDataListener or nullCreates a list data listener which will be added to the
|
| protected ComboPopup | |
| protected PropertyChangeListener | Returns: an instance of aPropertyChangeListener or nullCreates a |
| protected ListCellRenderer | Returns: aListCellRender used for the combo boxCreates the default renderer that will be used in a non-editiable combo box. |
| public static ComponentUI | Returns: a new instance ofBasicComboBoxUIa component c)Hides javax. Constructs a new instance of |
| public Accessible | getAccessibleChild(JComponent c, int i)
Overrides javax. Returns the |
| public int | getAccessibleChildrenCount(JComponent c)
Overrides javax. Returns the number of accessible children in the object. |
| public int | getBaseline(JComponent c, int width, int height)
Overrides javax. Returns the baseline. |
| public Component. | getBaselineResizeBehavior(JComponent c)
Overrides javax. Returns an enum indicating how the baseline of the component changes as the size changes. |
| private static ListCellRenderer | |
| protected Dimension | Returns: the size of an empty display areaReturn the default size of an empty display area of the combo box using the current renderer and font. |
| protected Dimension | Returns: the size of the display area calculated from the combo box itemsReturns the calculated size of the display area. |
| private BasicComboBoxUI. | |
| pack-priv InputMap | |
| protected Insets | |
| public Dimension | getMaximumSize(JComponent c)
Overrides javax. Returns the specified component's maximum size appropriate for the look and feel. |
| public Dimension | getMinimumSize(JComponent c)
Overrides javax. The minimum size is the size of the display area plus insets plus the button. |
| public Dimension | getPreferredSize(JComponent c)
Overrides javax. Returns the specified component's preferred size appropriate for the look and feel. |
| protected Dimension | Returns: size of the componenta comp)Component to checkReturns the size a component would have if used as a cell renderer. |
| protected void | |
| protected void | installDefaults()
Installs the default colors, default font, default renderer, and default editor into the JComboBox. |
| protected void | |
| protected void | |
| public void | installUI(JComponent c)
Overrides javax. Configures the specified component appropriately for the look and feel. |
| public boolean | isFocusTraversable(JComboBox<?> c)
Implements abstract javax. Determines if the JComboBox is focus traversable. |
| protected boolean | Returns: true if the supplied keyCode maps to a navigation keya key code keyCode)Returns whether or not the supplied keyCode maps to a key that is used for navigation. |
| private boolean | |
| public boolean | isPopupVisible(JComboBox<?> c)
Implements abstract javax. Tells if the popup is visible or not. |
| pack-priv boolean | |
| pack-priv static void | |
| public void | paint(Graphics g, JComponent c)
Overrides javax. Paints the specified component appropriately for the look and feel. |
| public void | paintCurrentValue(Graphics
an instance of g, Rectangle Graphicsa bounding rectangle to render to bounds, boolean is focused hasFocus)Paints the currently selected item. |
| public void | paintCurrentValueBackground(Graphics
an instance of g, Rectangle Graphicsa bounding rectangle to render to bounds, boolean is focused hasFocus)Paints the background of the currently selected item. |
| protected Rectangle | Returns: the area that is reserved for drawing the currently selected itemReturns the area that is reserved for drawing the currently selected item. |
| public void | |
| pack-priv void | |
| protected void | |
| protected void | |
| public void | setPopupVisible(JComboBox<?> c, boolean v)
Implements abstract javax. Hides the popup. |
| protected void | |
| public void | |
| protected void | |
| protected void | uninstallComponents()
The aggregate components which comprise the combo box are unregistered and uninitialized. |
| protected void | uninstallDefaults()
Uninstalls the default colors, default font, default renderer, and default editor from the combo box. |
| protected void | |
| protected void | |
| public void | uninstallUI(JComponent c)
Overrides javax. Reverses configuration which was done on the specified component during
|
| private void |