public class

MetalComboBoxButton

extends JButton
java.lang.Object
   ↳ java.awt.Component
     ↳ java.awt.Container
       ↳ javax.swing.JComponent
         ↳ javax.swing.AbstractButton
           ↳ javax.swing.JButton
             ↳ javax.swing.plaf.metal.MetalComboBoxButton

Class Overview

JButton subclass to help out MetalComboBoxUI

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

[Expand]
Inherited Constants
From class javax.swing.AbstractButton
From class javax.swing.JComponent
From class java.awt.Component
From interface java.awt.image.ImageObserver
From interface javax.swing.SwingConstants
Fields
protected JComboBox comboBox
protected Icon comboIcon
protected boolean iconOnly
protected JList listBox
protected CellRendererPane rendererPane
[Expand]
Inherited Fields
From class javax.swing.AbstractButton
From class javax.swing.JComponent
Public Constructors
MetalComboBoxButton(JComboBox cb, Icon i, CellRendererPane pane, JList list)
MetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList list)
Public Methods
final JComboBox getComboBox()
final Icon getComboIcon()
Dimension getMinimumSize()
If the minimum size has been set to a non-null value just returns it.
boolean isFocusTraversable()
This method is deprecated. As of 1.4, replaced by isFocusable().
final boolean isIconOnly()
void paintComponent(Graphics g)
Calls the UI delegate's paint method, if the UI delegate is non-null.
final void setComboBox(JComboBox cb)
final void setComboIcon(Icon i)
void setEnabled(boolean enabled)
Enables (or disables) the button.
final void setIconOnly(boolean isIconOnly)
[Expand]
Inherited Methods
From class javax.swing.JButton
From class javax.swing.AbstractButton
From class javax.swing.JComponent
From class java.awt.Container
From class java.awt.Component
From class java.lang.Object
From interface java.awt.ItemSelectable
From interface java.awt.MenuContainer
From interface java.awt.image.ImageObserver
From interface javax.accessibility.Accessible

Fields

protected JComboBox comboBox

protected Icon comboIcon

protected boolean iconOnly

protected JList listBox

protected CellRendererPane rendererPane

Public Constructors

public MetalComboBoxButton (JComboBox cb, Icon i, CellRendererPane pane, JList list)

public MetalComboBoxButton (JComboBox cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList list)

Public Methods

public final JComboBox getComboBox ()

public final Icon getComboIcon ()

public Dimension getMinimumSize ()

If the minimum size has been set to a non-null value just returns it. If the UI delegate's getMinimumSize method returns a non-null value then return that; otherwise defer to the component's layout manager.

Returns
  • the value of the minimumSize property

public boolean isFocusTraversable ()

This method is deprecated.
As of 1.4, replaced by isFocusable().

Returns whether this Component can become the focus owner.

Returns
  • true if this Component is focusable; false otherwise

public final boolean isIconOnly ()

public void paintComponent (Graphics g)

Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate).

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoker super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in a non-opaque color. If you do not honor the opaque property you will likely see visual artifacts.

The passed in Graphics object might have a transform other than the identify transform installed on it. In this case, you might get unexpected results if you cumulatively apply another transform.

Parameters
g the Graphics object to protect

public final void setComboBox (JComboBox cb)

public final void setComboIcon (Icon i)

public void setEnabled (boolean enabled)

Enables (or disables) the button.

Parameters
enabled true to enable the button, otherwise false

public final void setIconOnly (boolean isIconOnly)