Class MetalComboBoxUI
public class MetalComboBoxUI extends BasicComboBoxUI
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.
- See Also:
Nested Class Summary
| Modifier and Type | Class | Description |
|---|---|---|
class |
MetalComboBoxUI.MetalComboBoxLayoutManager |
This class should be treated as a "protected" inner class. |
class |
MetalComboBoxUI.MetalComboPopup |
Deprecated. As of Java 2 platform v1.4. |
class |
MetalComboBoxUI.MetalPropertyChangeListener |
This class should be treated as a "protected" inner class. |
Nested classes/interfaces declared in class BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler | Modifier and Type | Class | Description |
|---|---|---|
class |
BasicComboBoxUI.ComboBoxLayoutManager |
This layout manager handles the 'standard' layout of combo boxes. |
class |
BasicComboBoxUI.FocusHandler |
This listener hides the popup when the focus is lost. |
class |
BasicComboBoxUI.ItemHandler |
This listener watches for changes to the selection in the combo box. |
class |
BasicComboBoxUI.KeyHandler |
This listener checks to see if the key event isn't a navigation key. |
class |
BasicComboBoxUI.ListDataHandler |
This listener watches for changes in the ComboBoxModel. |
class |
BasicComboBoxUI.PropertyChangeHandler |
This listener watches for bound properties that have changed in the combo box. |
Field Summary
Fields declared in class BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButton | Modifier and Type | Field | Description |
|---|---|---|
protected JButton |
arrowButton |
The arrow button that invokes the popup. |
protected Dimension |
cachedMinimumSize |
The cached minimum preferred size. |
protected JComboBox |
comboBox |
The instance of JComboBox. |
protected CellRendererPane |
currentValuePane |
Used to render the currently selected item in the combo box. |
protected Component |
editor |
The Component that the ComboBoxEditor uses for editing. |
protected FocusListener |
focusListener |
This protected field is implementation specific. |
protected boolean |
hasFocus |
This protected field is implementation specific. |
protected boolean |
isMinimumSizeDirty |
The flag for recalculating the minimum preferred size. |
protected ItemListener |
itemListener |
This protected field is implementation specific. |
protected KeyListener |
keyListener |
This protected field is implementation specific. |
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 ComboPopup that is used to show the popup. |
protected KeyListener |
popupKeyListener |
The KeyListener listens to events. |
protected MouseListener |
popupMouseListener |
The MouseListener listens to events. |
protected MouseMotionListener |
popupMouseMotionListener |
The MouseMotionListener listens to events. |
protected PropertyChangeListener |
propertyChangeListener |
This protected field is implementation specific. |
protected boolean |
squareButton |
Indicates whether or not the combo box button should be square. |
Constructor Summary
| Constructor | Description |
|---|---|
MetalComboBoxUI() |
Constructs a MetalComboBoxUI. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
void |
configureEditor() |
This protected method is implementation specific and should be private. do not call or override. |
PropertyChangeListener |
createPropertyChangeListener() |
Creates a PropertyChangeListener which will be added to the combo box. |
static ComponentUI |
createUI |
Constructs an instance of MetalComboBoxUI. |
protected void |
editablePropertyChanged |
Deprecated. As of Java 2 platform v1.4. |
int |
getBaseline |
Returns the baseline. |
void |
layoutComboBox |
Lays out the JComboBox in the parent container. |
void |
paintCurrentValue |
If necessary paints the currently selected item. |
void |
paintCurrentValueBackground |
If necessary paints the background of the currently selected item. |
protected void |
removeListeners() |
Deprecated. As of Java 2 platform v1.4. |
void |
unconfigureEditor() |
This protected method is implementation specific and should be private. |
Methods declared in class BasicComboBoxUI
addEditor, configureArrowButton, createArrowButton, createEditor, createFocusListener, createItemListener, createKeyListener, createLayoutManager, createListDataListener, createPopup, createRenderer, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMinimumSize, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, installListeners, isFocusTraversable, isNavigationKey, isPopupVisible, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners | Modifier and Type | Method | Description |
|---|---|---|
void |
addEditor() |
This public method is implementation specific and should be private. do not call or override. |
void |
configureArrowButton() |
This public method is implementation specific and should be private. |
protected JButton |
createArrowButton() |
Creates a button which will be used as the control to show or hide the popup portion of the combo box. |
protected ComboBoxEditor |
createEditor() |
Creates the default editor that will be used in editable combo boxes. |
protected FocusListener |
createFocusListener() |
Creates a FocusListener which will be added to the combo box. |
protected ItemListener |
createItemListener() |
Creates an ItemListener which will be added to the combo box. |
protected KeyListener |
createKeyListener() |
Creates a KeyListener which will be added to the combo box. |
protected LayoutManager |
createLayoutManager() |
Creates a layout manager for managing the components which make up the combo box. |
protected ListDataListener |
createListDataListener() |
Creates a list data listener which will be added to the ComboBoxModel. |
protected ComboPopup |
createPopup() |
Creates the popup portion of the combo box. |
protected ListCellRenderer |
createRenderer() |
Creates the default renderer that will be used in a non-editiable combo box. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior |
Returns an enum indicating how the baseline of the component changes as the size changes. |
protected Dimension |
getDefaultSize() |
Return the default size of an empty display area of the combo box using the current renderer and font. |
protected Dimension |
getDisplaySize() |
Returns the calculated size of the display area. |
protected Insets |
getInsets() |
Gets the insets from the JComboBox. |
Dimension |
getMinimumSize |
The minimum size is the size of the display area plus insets plus the button. |
protected Dimension |
getSizeForComponent |
Returns the size a component would have if used as a cell renderer. |
protected void |
installComponents() |
Creates and initializes the components which make up the aggregate combo box. |
protected void |
installDefaults() |
Installs the default colors, default font, default renderer, and default editor into the JComboBox. |
protected void |
installKeyboardActions() |
Adds keyboard actions to the JComboBox. |
protected void |
installListeners() |
Creates and installs listeners for the combo box and its model. |
boolean |
isFocusTraversable |
Determines if the JComboBox is focus traversable. |
protected boolean |
isNavigationKey |
Returns whether or not the supplied keyCode maps to a key that is used for navigation. |
boolean |
isPopupVisible |
Tells if the popup is visible or not. |
protected Rectangle |
rectangleForCurrentValue() |
Returns the area that is reserved for drawing the currently selected item. |
void |
removeEditor() |
This public method is implementation specific and should be private. do not call or override. |
protected void |
selectNextPossibleValue() |
Selects the next item in the list. |
protected void |
selectPreviousPossibleValue() |
Selects the previous item in the list. |
void |
setPopupVisible |
Hides the popup. |
protected void |
toggleOpenClose() |
Hides the popup if it is showing and shows the popup if it is hidden. |
void |
unconfigureArrowButton() |
This public method is implementation specific and should be private. |
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 |
uninstallKeyboardActions() |
Removes the focus InputMap and ActionMap. |
protected void |
uninstallListeners() |
Removes the installed listeners from the combo box and its model. |
Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getPreferredSize, installUI, paint, uninstallUI, update | Modifier and Type | Method | Description |
|---|---|---|
boolean |
contains |
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component. |
Accessible |
getAccessibleChild |
Returns the ith Accessible child of the object. |
int |
getAccessibleChildrenCount |
Returns the number of accessible children in the object. |
Dimension |
getMaximumSize |
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
getPreferredSize |
Returns the specified component's preferred size appropriate for the look and feel. |
void |
installUI |
Configures the specified component appropriately for the look and feel. |
void |
paint |
Paints the specified component appropriately for the look and feel. |
void |
uninstallUI |
Reverses configuration which was done on the specified component during installUI. |
void |
update |
Notifies this UI delegate that it is time to paint the specified component. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
MetalComboBoxUI
public MetalComboBoxUI()
MetalComboBoxUI.Method Details
createUI
public static ComponentUI createUI(JComponent c)
MetalComboBoxUI.- Parameters:
-
c- a component - Returns:
- an instance of
MetalComboBoxUI
paintCurrentValue
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
- Overrides:
-
paintCurrentValuein classBasicComboBoxUI - Parameters:
-
g- Graphics to paint to -
bounds- Region to paint current value to -
hasFocus- whether or not the JComboBox has focus - Throws:
-
NullPointerException- if any of the arguments are null. - Since:
- 1.5
paintCurrentValueBackground
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
- Overrides:
-
paintCurrentValueBackgroundin classBasicComboBoxUI - Parameters:
-
g- Graphics to paint to -
bounds- Region to paint background to -
hasFocus- whether or not the JComboBox has focus - Throws:
-
NullPointerException- if any of the arguments are null. - Since:
- 1.5
getBaseline
public int getBaseline(JComponent c, int width, int height)
- Overrides:
-
getBaselinein classBasicComboBoxUI - Parameters:
-
c-JComponentbaseline is being requested for -
width- the width to get the baseline for -
height- the height to get the baseline for - Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
- Throws:
-
NullPointerException- ifcisnull -
IllegalArgumentException- if width or height is < 0 - Since:
- 1.6
- See Also:
createPropertyChangeListener
public PropertyChangeListener createPropertyChangeListener()
BasicComboBoxUIPropertyChangeListener which will be added to the combo box. If this method returns null then it will not be added to the combo box.- Overrides:
-
createPropertyChangeListenerin classBasicComboBoxUI - Returns:
- an instance of a
PropertyChangeListeneror null
editablePropertyChanged
@Deprecated protected void editablePropertyChanged(PropertyChangeEvent e)
- Parameters:
-
e- an instance ofPropertyChangeEvent
layoutComboBox
public void layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
JComboBox in the parent container.- Parameters:
-
parent- a container -
manager- an instance ofMetalComboBoxLayoutManager
removeListeners
@Deprecated protected void removeListeners()
configureEditor
public void configureEditor()
BasicComboBoxUI- Overrides:
-
configureEditorin classBasicComboBoxUI - See Also:
unconfigureEditor
public void unconfigureEditor()
BasicComboBoxUI- Overrides:
-
unconfigureEditorin classBasicComboBoxUI - See Also:
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.