javax.swing.plaf.basic
public class BasicComboBoxUI extends ComboBoxUI
Nested Class Summary | |
---|---|
class | BasicComboBoxUI.ComboBoxLayoutManager
A {@link LayoutManager} used to position the sub-components of the
{@link JComboBox}.
|
class | BasicComboBoxUI.FocusHandler
Handles focus changes occuring in the combo box. |
class | BasicComboBoxUI.ItemHandler
Handles {@link ItemEvent}s fired by the {@link JComboBox} when its
selected item changes. |
class | BasicComboBoxUI.KeyHandler
KeyHandler handles key events occuring while JComboBox has focus. |
class | BasicComboBoxUI.ListDataHandler
Handles the changes occurring in the JComboBox's data model. |
class | BasicComboBoxUI.PropertyChangeHandler
Handles {@link PropertyChangeEvent}s fired by the {@link JComboBox}. |
Field Summary | |
---|---|
protected JButton | arrowButton
The arrow button that is displayed in the right side of JComboBox. |
protected Dimension | cachedMinimumSize
The current minimum size if isMinimumSizeDirty is false.
|
protected JComboBox | comboBox
The combo box represented by this UI delegate. |
protected CellRendererPane | currentValuePane
Used to render the combo box values. |
protected Component | editor
The component that is responsible for displaying/editing the selected
item of the combo box.
|
protected FocusListener | focusListener
A listener listening to focus events occurring in the {@link JComboBox}. |
protected boolean | hasFocus
A flag indicating whether JComboBox currently has the focus. |
protected boolean | isMinimumSizeDirty
Indicates whether or not the cachedMinimumSize field is valid or not. |
protected ItemListener | itemListener
A listener listening to item events fired by the {@link JComboBox}. |
protected KeyListener | keyListener
A listener listening to key events that occur while {@link JComboBox} has
the focus. |
protected JList | listBox
List used when rendering selected item of the combo box. |
protected ListDataListener | listDataListener
ListDataListener listening to JComboBox model |
protected ComboPopup | popup
Popup list containing the combo box's menu items. |
protected KeyListener | popupKeyListener |
protected MouseListener | popupMouseListener |
protected MouseMotionListener | popupMouseMotionListener |
protected PropertyChangeListener | propertyChangeListener
Listener listening to changes in the bound properties of JComboBox |
Constructor Summary | |
---|---|
BasicComboBoxUI()
Creates a new BasicComboBoxUI object. |
Method Summary | |
---|---|
void | addEditor()
Adds the current editor to the combo box. |
void | configureArrowButton()
Configures the arrow button.
|
protected void | configureEditor()
Configures the editor for this combo box. |
protected JButton | createArrowButton()
Creates an arrow button for this {@link JComboBox}. |
protected ComboBoxEditor | createEditor()
Creates the component that will be responsible for displaying/editing
the selected item in the combo box. |
protected FocusListener | createFocusListener()
Creates the {@link FocusListener} that will listen to changes in this
JComboBox's focus.
|
protected ItemListener | createItemListener()
Creates an {@link ItemListener} that will listen to the changes in
the JComboBox's selection.
|
protected KeyListener | createKeyListener()
Creates a {@link KeyListener} to listen to key events.
|
protected LayoutManager | createLayoutManager()
Creates and returns a layout manager for the combo box. |
protected ListDataListener | createListDataListener()
Creates a {@link ListDataListener} to listen to the combo box's data model.
|
protected ComboPopup | createPopup()
Creates the popup that will contain list of combo box's items.
|
protected PropertyChangeListener | createPropertyChangeListener()
Creates a {@link PropertyChangeListener} to listen to the changes in
the JComboBox's bound properties.
|
protected ListCellRenderer | createRenderer()
Creates a component that will be responsible for rendering the
selected component in the combo box.
|
static ComponentUI | createUI(JComponent c)
A factory method to create a UI delegate for the given
{@link JComponent}, which should be a {@link JComboBox}.
|
Accessible | getAccessibleChild(JComponent c, int i)
Returns the accessible child with the specified index.
|
int | getAccessibleChildrenCount(JComponent c)
Returns the number of accessible children of the combobox.
|
protected Dimension | getDefaultSize()
Returns the default size for the display area of a combo box that does
not contain any elements. |
protected Dimension | getDisplaySize()
Returns the size of the display area for the combo box. |
protected Insets | getInsets()
Returns the insets of the current border.
|
Dimension | getMaximumSize(JComponent c)
Returns the maximum size for this {@link JComboBox} for this
look and feel.
|
Dimension | getMinimumSize(JComponent c)
Returns the minimum size for this {@link JComboBox} for this
look and feel. |
Dimension | getPreferredSize(JComponent c)
Returns preferred size for the combo box.
|
protected void | installComponents()
Installs the components for this JComboBox. |
protected void | installDefaults()
Installs the defaults that are defined in the {@link BasicLookAndFeel}
for this {@link JComboBox}.
|
protected void | installKeyboardActions()
Installs the keyboard actions for the {@link JComboBox} as specified
by the look and feel. |
protected void | installListeners()
Creates and installs the listeners for this UI.
|
void | installUI(JComponent c)
Installs the UI for the given {@link JComponent}.
|
boolean | isFocusTraversable(JComboBox c)
JComboBox is focus traversable if it is editable and not otherwise.
|
protected boolean | isNavigationKey(int keyCode)
Returns true if the specified key is a navigation key and false otherwise
|
boolean | isPopupVisible(JComboBox c)
Returns true if the popup is visible, and false
otherwise.
|
void | paint(Graphics g, JComponent c)
Paints given menu item using specified graphics context
|
void | paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
Paints currently selected value in the main part of the combo
box (part without popup).
|
void | paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
Paints the background of part of the combo box, where currently
selected value is displayed. |
protected Rectangle | rectangleForCurrentValue()
Returns the bounds in which comboBox's selected item will be
displayed.
|
void | removeEditor()
Removes the current editor from the combo box. |
protected void | selectNextPossibleValue()
Selects next possible item relative to the current selection
to be next selected item in the combo box. |
protected void | selectPreviousPossibleValue()
Selects previous item relative to current selection to be
next selected item. |
void | setPopupVisible(JComboBox c, boolean v)
Displays/hides the {@link JComboBox}'s list of items on the screen.
|
protected void | toggleOpenClose()
Displays combo box popup if the popup is not currently shown
on the screen and hides it if it is currently shown |
void | unconfigureArrowButton()
Unconfigures the arrow button.
|
protected void | unconfigureEditor()
Unconfigures the editor for this combo box. |
protected void | uninstallComponents()
Uninstalls components from this {@link JComboBox}.
|
protected void | uninstallDefaults()
Uninstalls the defaults and sets any objects created during
install to null .
|
protected void | uninstallKeyboardActions()
Uninstalls the keyboard actions for the {@link JComboBox} there were
installed by in {@link #installListeners}. |
protected void | uninstallListeners()
Detaches all the listeners we attached in {@link #installListeners}.
|
void | uninstallUI(JComponent c)
Uninstalls the UI for the given {@link JComponent}.
|
See Also: getEditorComponent
BasicComboBoxUI
object.See Also: configureArrowButton
Returns: A new button.
Returns: A new component that will be responsible for displaying/editing the selected item in the combo box.
Returns: the FocusListener.
Returns: The ItemListener
Returns: KeyListener that listens to key events.
Returns: a layout manager for the combo box.
Returns: The new listener.
Returns: popup containing list of combo box's items
Returns: The PropertyChangeListener
Returns: A renderer for the combo box.
Parameters: c The {@link JComponent} a UI is being created for.
Returns: A UI delegate for the {@link JComponent}.
Parameters: c the component, this is ignored i the index of the accessible child to return
Parameters: c the component (combobox) to check, ignored
Returns: the number of accessible children of the combobox
Returns: The default display size.
See Also: getDisplaySize
Returns: The size of the display area for the combo box.
Returns: Insets representing space between combo box and its border
Parameters: c The {@link JComponent} to find the maximum size for
Returns: The maximum size (Dimension(32767, 32767)
).
Parameters: c The {@link JComponent} to find the minimum size for.
Returns: The dimensions of the minimum size.
Parameters: c comboBox for which to get preferred size
Returns: The preferred size for the given combo box
See Also: uninstallDefaults
See Also: uninstallListeners
Parameters: c the JComponent to install a UI for.
See Also: uninstallUI
Parameters: c combo box for which to check whether it is focus traversable
Returns: true if focus tranversable and false otherwise
Parameters: keyCode a key for which to check whether it is navigation key or not.
Returns: true if the specified key is a navigation key and false otherwis
true
if the popup is visible, and false
otherwise.
Parameters: c The JComboBox to check
Returns: true
if popup part of the JComboBox is visible and
false
otherwise.
Parameters: g The graphics context used to paint this combo box c comboBox which needs to be painted.
Parameters: g graphics context bounds Rectangle representing the size of the area in which selected item should be drawn hasFocus true if combo box has focus and false otherwise
Parameters: g graphics context bounds Rectangle representing the size of the largest item in the comboBox hasFocus true if combo box has fox and false otherwise
Returns: rectangle bounds in which comboBox's selected Item will be displayed
Parameters: c The combo box, for which list of items should be displayed/hidden v true if show popup part of the jcomboBox and false to hide.
UNKNOWN: The specification says this method is implementation specific and should not be used or overridden.
See Also: installComponents
null
.
See Also: installDefaults
See Also: installListeners
Parameters: c The JComponent that is having this UI removed.
See Also: installUI