public class

WindowsComboBoxUI

extends BasicComboBoxUI
java.lang.Object
   ↳ javax.swing.plaf.ComponentUI
     ↳ javax.swing.plaf.ComboBoxUI
       ↳ javax.swing.plaf.basic.BasicComboBoxUI
         ↳ com.sun.java.swing.plaf.windows.WindowsComboBoxUI

Class Overview

Windows combo box.

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. A future release of Swing will provide support for long term persistence.

Summary

Nested Classes
class WindowsComboBoxUI.WindowsComboBoxEditor Subclassed to highlight selected item in an editable combo box. 
class WindowsComboBoxUI.WindowsComboPopup This class is deprecated. As of Java 2 platform v1.4.  
[Expand]
Inherited Fields
From class javax.swing.plaf.basic.BasicComboBoxUI
Public Constructors
WindowsComboBoxUI()
Public Methods
static ComponentUI createUI(JComponent c)
Dimension getMinimumSize(JComponent c)
The minumum size is the size of the display area plus insets plus the button.
void installUI(JComponent c)
Configures the specified component appropriate for the look and feel.
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)
Paints the background of the currently selected item.
void uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI.
Protected Methods
void configureEditor()
This protected method is implementation specific and should be private.
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.
ListCellRenderer createRenderer()
Creates the default renderer that will be used in a non-editiable combo box.
void installKeyboardActions()
Adds keyboard actions to the JComboBox.
void installListeners()
Create and install the listeners for the combo box and its model.
void unconfigureEditor()
This protected method is implementation specific and should be private.
void uninstallListeners()
Remove the installed listeners from the combo box and its model.
[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 WindowsComboBoxUI ()

Public Methods

public static ComponentUI createUI (JComponent c)

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 installUI (JComponent c)

Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:

  1. Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.

Parameters
c the component where this UI delegate is being installed

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)

Paints the background of the currently selected item.

public void uninstallUI (JComponent c)

Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:

  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.

Parameters
c the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components

Protected Methods

protected void configureEditor ()

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

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 ListCellRenderer createRenderer ()

Creates the default renderer that will be used in a non-editiable combo box. A default renderer will used only if a renderer has not been explicitly set with setRenderer.

Returns
  • a ListCellRender used for the combo box

protected void installKeyboardActions ()

Adds keyboard actions to the JComboBox. Actions on enter and esc are already supplied. Add more actions as you need them.

protected void installListeners ()

Create and install the listeners for the combo box and its model. This method is called when the UI is installed.

protected void unconfigureEditor ()

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

protected void uninstallListeners ()

Remove the installed listeners from the combo box and its model. The number and types of listeners removed and in this method should be the same that was added in installListeners