Top Description Inners Fields Constructors Methods
javax.swing.plaf.synth

public Class SynthComboBoxUI

extends BasicComboBoxUI
implements PropertyChangeListener, SynthUI
Class Inheritance
All Implemented Interfaces
javax.swing.plaf.synth.SynthUI, javax.swing.plaf.synth.SynthConstants, java.beans.PropertyChangeListener, java.util.EventListener
Imports
java.awt.Component, .Dimension, .Graphics, .Insets, .Rectangle, java.awt.event.FocusEvent, .FocusListener, .MouseEvent, .MouseListener, java.beans.PropertyChangeEvent, .PropertyChangeListener, javax.swing.ComboBoxEditor, .DefaultButtonModel, .DefaultListCellRenderer, .Icon, .JButton, .JComboBox, .JComponent, .JLabel, .JList, .JPanel, .JTextField, .ListCellRenderer, .SwingConstants, javax.swing.event.PopupMenuEvent, .PopupMenuListener, javax.swing.plaf.ComponentUI, .UIResource, javax.swing.plaf.basic.BasicComboBoxEditor, .BasicComboBoxUI, .ComboPopup

Provides the Synth L&F UI delegate for javax.swing.JComboBox.
Author
Scott Violet
Since
1.7

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
SynthComboBoxUI.ButtonHandler

Handles all the logic for treating the combo as a button when it is not editable, and when shouldActLikeButton() is true.

private static class
SynthComboBoxUI.DlcrEnabledHandler

Handler for updating combobox enabled status when renderer enabled status changes

private static class
SynthComboBoxUI.EditorFocusHandler

Handler for repainting combo when editor component gains/looses focus

private static class
private class
SynthComboBoxUI.SynthComboBoxRenderer

From BasicComboBoxRenderer v 1.18.

Field Summary

Modifier and TypeField and Description
private SynthComboBoxUI.ButtonHandler
buttonHandler

When buttonWhenNotEditable is true, this field is used to help make the combo box appear and function as a button when the combo box is not editable.

private boolean
buttonWhenNotEditable

This flag may be set via UIDefaults.

private SynthComboBoxUI.DlcrEnabledHandler
private SynthComboBoxUI.EditorFocusHandler
editorFocusHandler

Handler for repainting combo when editor component gains/looses focus

private boolean
forceOpaque

If true, then the cell renderer will be forced to be non-opaque when used for rendering the selected item in the combo box (not in the list), and forced to opaque after rendering the selected value.

pack-priv Insets
popupInsets

Used to adjust the location and size of the popup.

private boolean
pressedWhenPopupVisible

A flag to indicate that the combo box and combo box button should remain in the PRESSED state while the combo popup is visible.

private SynthStyle
private boolean
Inherited from javax.swing.plaf.basic.BasicComboBoxUI:
arrowButtoncachedMinimumSizecomboBoxcurrentValuePaneeditorfocusListenerhasFocusisMinimumSizeDirtyitemListenerkeyListenerlistBoxlistDataListenerpaddingpopuppopupKeyListenerpopupMouseListenerpopupMouseMotionListenerpropertyChangeListenersquareButton

Constructor Summary

AccessConstructor and Description
public
SynthComboBoxUI()

Constructs a SynthComboBoxUI.

Method Summary

Modifier and TypeMethod and Description
protected JButton
createArrowButton()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.createArrowButton.

Creates a button which will be used as the control to show or hide the popup portion of the combo box.
protected ComboBoxEditor
createEditor()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.createEditor.

Creates the default editor that will be used in editable combo boxes.
protected ComboPopup
createPopup()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.createPopup.

Creates the popup portion of the combo box.
protected ListCellRenderer<Object>
createRenderer()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.createRenderer.

Creates the default renderer that will be used in a non-editiable combo box.
public static ComponentUI

Returns:

the UI object
createUI
(JComponent
component to create UI object for
c
)

Hides javax.swing.plaf.basic.BasicComboBoxUI.createUI.

Creates a new UI object for the given component.
private int
public SynthContext
getContext(JComponent
Component requesting SynthContext.
c
)

Implements javax.swing.plaf.synth.SynthUI.getContext.

Returns the Context for the specified component.
private SynthContext
getContext(JComponent c, int state)

protected Dimension

Returns:

the size of an empty display area
getDefaultSize
()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.getDefaultSize.

Returns the default size of an empty display area of the combo box using the current renderer and font.
public Dimension
getMinimumSize(JComponent
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
c
)

Overrides javax.swing.plaf.basic.BasicComboBoxUI.getMinimumSize.

The minimum size is the size of the display area plus insets plus the button.
protected void
installDefaults()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.installDefaults.

Installs the default colors, default font, default renderer, and default editor into the JComboBox.
protected void
installListeners()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.installListeners.

Creates and installs listeners for the combo box and its model.
public void
installUI(JComponent
the component where this UI delegate is being installed
c
)

Overrides javax.swing.plaf.basic.BasicComboBoxUI.installUI.

Configures the specified component appropriately for the look and feel.
public void
paint(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.basic.BasicComboBoxUI.paint.

Paints the specified component according to the Look and Feel.
protected void
paint(SynthContext
context for the component being painted
context
,
Graphics
the Graphics object used for painting
g
)

Paints the specified component.

public void
paintBorder(SynthContext
a component context
context
,
Graphics
Graphics to paint on
g
,
int
the X coordinate
x
,
int
the Y coordinate
y
,
int
width of the border
w
,
int
height of the border
h
)

Implements javax.swing.plaf.synth.SynthUI.paintBorder.

Paints the border.
public void
paintCurrentValue(Graphics
an instance of Graphics
g
,
Rectangle
a bounding rectangle to render to
bounds
,
boolean
is focused
hasFocus
)

Overrides javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue.

Paints the currently selected item.
public void
propertyChange(PropertyChangeEvent
A PropertyChangeEvent object describing the event source and the property that has changed.
e
)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.
private boolean

Returns:

true if this combo box should act as one big button. Typically only happens when buttonWhenNotEditable is true, and comboBox.isEditable is false.
shouldActLikeButton
()

protected void
uninstallDefaults()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.uninstallDefaults.

Uninstalls the default colors, default font, default renderer, and default editor from the combo box.
protected void
uninstallListeners()

Overrides javax.swing.plaf.basic.BasicComboBoxUI.uninstallListeners.

Removes the installed listeners from the combo box and its model.
public void
uninstallUI(JComponent
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
c
)

Overrides javax.swing.plaf.basic.BasicComboBoxUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI.
public void
update(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.ComponentUI.update.

Notifies this UI delegate to repaint the specified component.
private void
updateStyle(JComboBox<?> comboBox)

Inherited from javax.swing.plaf.basic.BasicComboBoxUI:
addEditorconfigureArrowButtonconfigureEditorcreateFocusListenercreateItemListenercreateKeyListenercreateLayoutManagercreateListDataListenercreatePropertyChangeListenergetAccessibleChildgetAccessibleChildrenCountgetBaselinegetBaselineResizeBehaviorgetDisplaySizegetInsetsgetMaximumSizegetPreferredSizegetSizeForComponentinstallComponentsinstallKeyboardActionsisFocusTraversableisNavigationKeyisPopupVisiblepaintCurrentValueBackgroundrectangleForCurrentValueremoveEditorselectNextPossibleValueselectPreviousPossibleValuesetPopupVisibletoggleOpenCloseunconfigureArrowButtonunconfigureEditoruninstallComponentsuninstallKeyboardActions