javax.swing.plaf.basic

Class BasicComboBoxRenderer

public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer, Serializable

A renderer for a {@link JComboBox}.
Nested Class Summary
static classBasicComboBoxRenderer.UIResource
A subclass of {@link BasicComboBoxRenderer} that implements the {@link javax.swing.plaf.UIResource} interface.
Field Summary
protected static BordernoFocusBorder
A shared border instance for all renderers.
Constructor Summary
BasicComboBoxRenderer()
Creates a new BasicComboBoxRenderer object.
Method Summary
ComponentgetListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
Returns a component that has been configured to display the given value.
DimensiongetPreferredSize()
Returns preferredSize of the renderer

Field Detail

noFocusBorder

protected static Border noFocusBorder
A shared border instance for all renderers.

Constructor Detail

BasicComboBoxRenderer

public BasicComboBoxRenderer()
Creates a new BasicComboBoxRenderer object.

Method Detail

getListCellRendererComponent

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
Returns a component that has been configured to display the given value.

Parameters: list List of items for which to the background and foreground colors value object that should be rendered in the cell index index of the cell in the list of items. isSelected draw cell highlighted if isSelected is true cellHasFocus draw focus rectangle around cell if the cell has focus

Returns: Component that will be used to draw the desired cell.

getPreferredSize

public Dimension getPreferredSize()
Returns preferredSize of the renderer

Returns: preferredSize of the renderer