public class

MetalComboBoxUI

extends BasicComboBoxUI
java.lang.Object
   ↳ javax.swing.plaf.ComponentUI
     ↳ javax.swing.plaf.ComboBoxUI
       ↳ javax.swing.plaf.basic.BasicComboBoxUI
         ↳ javax.swing.plaf.metal.MetalComboBoxUI

Class Overview

Metal UI for JComboBox

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 JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

Summary

Nested Classes
class MetalComboBoxUI.MetalComboBoxLayoutManager This inner class is marked "public" due to a compiler bug. 
class MetalComboBoxUI.MetalComboPopup This class is deprecated. As of Java 2 platform v1.4.  
class MetalComboBoxUI.MetalPropertyChangeListener This inner class is marked "public" due to a compiler bug. 
[Expand]
Inherited Fields
From class javax.swing.plaf.basic.BasicComboBoxUI
Public Constructors
MetalComboBoxUI()
Public Methods
void configureEditor()
This protected method is implementation specific and should be private.
PropertyChangeListener createPropertyChangeListener()
Creates a PropertyChangeListener which will be added to the combo box.
static ComponentUI createUI(JComponent c)
int getBaseline(JComponent c, int width, int height)
Returns the baseline.
Dimension getMinimumSize(JComponent c)
The minumum size is the size of the display area plus insets plus the button.
void layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
void paint(Graphics g, JComponent c)
Paints the specified component appropriate for the look and feel.
void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the currently selected item.
void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the background of the currently selected item.
void unconfigureEditor()
This protected method is implementation specific and should be private.
Protected Methods
JButton createArrowButton()
Creates an button which will be used as the control to show or hide the popup portion of the combo box.
ComboBoxEditor createEditor()
Creates the default editor that will be used in editable combo boxes.
LayoutManager createLayoutManager()
Creates a layout manager for managing the components which make up the combo box.
ComboPopup createPopup()
Creates the popup portion of the combo box.
void editablePropertyChanged(PropertyChangeEvent e)
This method is deprecated. As of Java 2 platform v1.4.
void removeListeners()
This method is deprecated. As of Java 2 platform v1.4.
[Expand]
Inherited Methods
From class javax.swing.plaf.basic.BasicComboBoxUI
From class javax.swing.plaf.ComboBoxUI
From class javax.swing.plaf.ComponentUI
From class java.lang.Object

Public Constructors

public MetalComboBoxUI ()

Public Methods

public void configureEditor ()

This protected method is implementation specific and should be private. do not call or override.

public PropertyChangeListener createPropertyChangeListener ()

Creates a PropertyChangeListener which will be added to the combo box. If this method returns null then it will not be added to the combo box.

Returns
  • an instance of a PropertyChangeListener or null

public static ComponentUI createUI (JComponent c)

public int getBaseline (JComponent c, int width, int height)

Returns the baseline.

Parameters
c JComponent baseline 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

public Dimension getMinimumSize (JComponent c)

The minumum size is the size of the display area plus insets plus the button.

Parameters
c the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Returns
  • a Dimension object or null

public void layoutComboBox (Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)

public void paint (Graphics g, JComponent c)

Paints the specified component appropriate for the look and feel. This method is invoked from the ComponentUI.update method when the specified component is being painted. Subclasses should override this method and use the specified Graphics object to render the content of the component.

Parameters
g the Graphics context in which to paint
c the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components

public void paintCurrentValue (Graphics g, Rectangle bounds, boolean hasFocus)

If necessary paints the currently selected item.

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.

public void paintCurrentValueBackground (Graphics g, Rectangle bounds, boolean hasFocus)

If necessary paints the background of the currently selected item.

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.

public void unconfigureEditor ()

This protected method is implementation specific and should be private. Do not call or override.

Protected Methods

protected JButton createArrowButton ()

Creates an button which will be used as the control to show or hide the popup portion of the combo box.

Returns
  • a button which represents the popup control

protected ComboBoxEditor createEditor ()

Creates the default editor that will be used in editable combo boxes. A default editor will be used only if an editor has not been explicitly set with setEditor.

Returns
  • a ComboBoxEditor used for the combo box

protected LayoutManager createLayoutManager ()

Creates a layout manager for managing the components which make up the combo box.

Returns
  • an instance of a layout manager

protected ComboPopup createPopup ()

Creates the popup portion of the combo box.

Returns
  • an instance of ComboPopup

protected void editablePropertyChanged (PropertyChangeEvent e)

This method is deprecated.
As of Java 2 platform v1.4.

As of Java 2 platform v1.4 this method is no longer used. Do not call or override. All the functionality of this method is in the MetalPropertyChangeListener.

protected void removeListeners ()

This method is deprecated.
As of Java 2 platform v1.4.

As of Java 2 platform v1.4 this method is no longer used.