APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.plaf.metal

public Class MetalComboBoxButton

extends JButton
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.awt.*, java.awt.event.*, javax.swing.plaf.basic.*, javax.swing.*, javax.swing.plaf.*, javax.swing.border.*, java.io.Serializable

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

Author
Tom Santos
See Also
MetalComboBoxButton

Field Summary

Modifier and TypeField and Description
protected JComboBox<Object>
comboBox

The instance of JComboBox.

protected Icon
comboIcon

The icon.

protected boolean
iconOnly

The iconOnly value.

protected JList<Object>
listBox

The instance of JList.

protected CellRendererPane
rendererPane

The instance of CellRendererPane.

Constructor Summary

AccessConstructor and Description
pack-priv
public
MetalComboBoxButton(JComboBox<Object>
an instance of JComboBox
cb
,
Icon
an icon
i
,
CellRendererPane
an instance of CellRendererPane
pane
,
JList<Object>
an instance of JList
list
)

Constructs a new instance of MetalComboBoxButton.

public
MetalComboBoxButton(JComboBox<Object>
an instance of JComboBox
cb
,
Icon
an icon
i
,
boolean
if true only icon is painted
onlyIcon
,
CellRendererPane
an instance of CellRendererPane
pane
,
JList<Object>
an instance of JList
list
)

Constructs a new instance of MetalComboBoxButton.

Method Summary

Modifier and TypeMethod and Description
public final JComboBox<Object>

Returns:

the JComboBox
getComboBox
()

Returns the JComboBox.

public final Icon

Returns:

the icon of the JComboBox
getComboIcon
()

Returns the icon of the JComboBox.

public Dimension
getMinimumSize()

Overrides javax.swing.JComponent.getMinimumSize.

If the minimum size has been set to a non-null value just returns it.

public boolean
isFocusTraversable()

Overrides java.awt.Component.isFocusTraversable.

Returns whether this Component can become the focus owner.

public final boolean

Returns:

the isIconOnly value
isIconOnly
()

Returns the isIconOnly value.

public void
paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

Calls the UI delegate's paint method, if the UI delegate is non-null.

public final void
setComboBox(JComboBox<Object>
the JComboBox
cb
)

Sets the JComboBox.

public final void
setComboIcon(Icon
the icon of the JComboBox
i
)

Sets the icon of the JComboBox.

public void
setEnabled(boolean enabled)

Overrides javax.swing.AbstractButton.setEnabled.

Enables (or disables) the button.

public final void
setIconOnly(boolean
if true then only icon is painted
isIconOnly
)

If isIconOnly is true then only icon is painted.

Inherited from javax.swing.JButton:
getAccessibleContextgetUIClassIDisDefaultButtonisDefaultCapableparamStringremoveNotifysetDefaultCapableupdateUI

Field Detail

comboBoxback to summary
protected JComboBox<Object> comboBox

The instance of JComboBox.

comboIconback to summary
protected Icon comboIcon

The icon.

iconOnlyback to summary
protected boolean iconOnly

The iconOnly value.

listBoxback to summary
protected JList<Object> listBox

The instance of JList.

rendererPaneback to summary
protected CellRendererPane rendererPane

The instance of CellRendererPane.

Constructor Detail

MetalComboBoxButtonback to summary
pack-priv MetalComboBoxButton()
MetalComboBoxButtonback to summary
public MetalComboBoxButton(JComboBox<Object> cb, Icon i, CellRendererPane pane, JList<Object> list)

Constructs a new instance of MetalComboBoxButton.

Parameters
cb:JComboBox<Object>

an instance of JComboBox

i:Icon

an icon

pane:CellRendererPane

an instance of CellRendererPane

list:JList<Object>

an instance of JList

MetalComboBoxButtonback to summary
public MetalComboBoxButton(JComboBox<Object> cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList<Object> list)

Constructs a new instance of MetalComboBoxButton.

Parameters
cb:JComboBox<Object>

an instance of JComboBox

i:Icon

an icon

onlyIcon:boolean

if true only icon is painted

pane:CellRendererPane

an instance of CellRendererPane

list:JList<Object>

an instance of JList

Method Detail

getComboBoxback to summary
public final JComboBox<Object> getComboBox()

Returns the JComboBox.

Returns:JComboBox<Object>

the JComboBox

getComboIconback to summary
public final Icon getComboIcon()

Returns the icon of the JComboBox.

Returns:Icon

the icon of the JComboBox

getMinimumSizeback to summary
public Dimension getMinimumSize()

Overrides javax.swing.JComponent.getMinimumSize.

Doc from javax.swing.JComponent.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.

isFocusTraversableback to summary
public boolean isFocusTraversable()

Overrides java.awt.Component.isFocusTraversable.

Doc from java.awt.Component.isFocusTraversable.

Returns whether this Component can become the focus owner.

Annotations
@SuppressWarnings:deprecation
isIconOnlyback to summary
public final boolean isIconOnly()

Returns the isIconOnly value.

Returns:boolean

the isIconOnly value

paintComponentback to summary
public void paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

Doc from javax.swing.JComponent.paintComponent.

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 invoke super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in an 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.

setComboBoxback to summary
public final void setComboBox(JComboBox<Object> cb)

Sets the JComboBox.

Parameters
cb:JComboBox<Object>

the JComboBox

setComboIconback to summary
public final void setComboIcon(Icon i)

Sets the icon of the JComboBox.

Parameters
i:Icon

the icon of the JComboBox

setEnabledback to summary
public void setEnabled(boolean enabled)

Overrides javax.swing.AbstractButton.setEnabled.

Doc from javax.swing.AbstractButton.setEnabled.

Enables (or disables) the button.

setIconOnlyback to summary
public final void setIconOnly(boolean isIconOnly)

If isIconOnly is true then only icon is painted.

Parameters
isIconOnly:boolean

if true then only icon is painted