public class BasicComboBoxUI extends javax.swing.plaf.ComboBoxUI
JComboBox component.| Modifier and Type | Class and Description |
|---|---|
class |
BasicComboBoxUI.ComboBoxLayoutManager
A
LayoutManager used to position the sub-components of the
JComboBox. |
class |
BasicComboBoxUI.FocusHandler
Handles focus changes occuring in the combo box.
|
class |
BasicComboBoxUI.ItemHandler
Handles
ItemEvents fired by the 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
PropertyChangeEvents fired by the JComboBox. |
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.JButton |
arrowButton
The arrow button that is displayed in the right side of JComboBox.
|
protected java.awt.Dimension |
cachedMinimumSize
The current minimum size if isMinimumSizeDirty is false.
|
protected javax.swing.JComboBox |
comboBox
The combo box represented by this UI delegate.
|
protected javax.swing.CellRendererPane |
currentValuePane
Used to render the combo box values.
|
protected java.awt.Component |
editor
The component that is responsible for displaying/editing the selected
item of the combo box.
|
protected java.awt.event.FocusListener |
focusListener
A listener listening to focus events occurring in the
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 java.awt.event.ItemListener |
itemListener
A listener listening to item events fired by the
JComboBox. |
protected java.awt.event.KeyListener |
keyListener
A listener listening to key events that occur while
JComboBox has
the focus. |
protected javax.swing.JList |
listBox
List used when rendering selected item of the combo box.
|
protected javax.swing.event.ListDataListener |
listDataListener
ListDataListener listening to JComboBox model
|
protected ComboPopup |
popup
Popup list containing the combo box's menu items.
|
protected java.awt.event.KeyListener |
popupKeyListener |
protected java.awt.event.MouseListener |
popupMouseListener |
protected java.awt.event.MouseMotionListener |
popupMouseMotionListener |
protected java.beans.PropertyChangeListener |
propertyChangeListener
Listener listening to changes in the bound properties of JComboBox
|
| Constructor and Description |
|---|
BasicComboBoxUI()
Creates a new
BasicComboBoxUI object. |
| Modifier and Type | Method and Description |
|---|---|
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 javax.swing.JButton |
createArrowButton()
Creates an arrow button for this
JComboBox. |
protected javax.swing.ComboBoxEditor |
createEditor()
Creates the component that will be responsible for displaying/editing
the selected item in the combo box.
|
protected java.awt.event.FocusListener |
createFocusListener()
Creates the
FocusListener that will listen to changes in this
JComboBox's focus. |
protected java.awt.event.ItemListener |
createItemListener()
Creates an
ItemListener that will listen to the changes in
the JComboBox's selection. |
protected java.awt.event.KeyListener |
createKeyListener()
Creates a
KeyListener to listen to key events. |
protected java.awt.LayoutManager |
createLayoutManager()
Creates and returns a layout manager for the combo box.
|
protected javax.swing.event.ListDataListener |
createListDataListener()
Creates a
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 java.beans.PropertyChangeListener |
createPropertyChangeListener()
Creates a
PropertyChangeListener to listen to the changes in
the JComboBox's bound properties. |
protected javax.swing.ListCellRenderer |
createRenderer()
Creates a component that will be responsible for rendering the
selected component in the combo box.
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
A factory method to create a UI delegate for the given
JComponent, which should be a JComboBox. |
javax.accessibility.Accessible |
getAccessibleChild(javax.swing.JComponent c,
int i)
Returns the accessible child with the specified index.
|
int |
getAccessibleChildrenCount(javax.swing.JComponent c)
Returns the number of accessible children of the combobox.
|
protected java.awt.Dimension |
getDefaultSize()
Returns the default size for the display area of a combo box that does
not contain any elements.
|
protected java.awt.Dimension |
getDisplaySize()
Returns the size of the display area for the combo box.
|
protected java.awt.Insets |
getInsets()
Returns the insets of the current border.
|
java.awt.Dimension |
getMaximumSize(javax.swing.JComponent c)
Returns the maximum size for this
JComboBox for this
look and feel. |
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c)
Returns the minimum size for this
JComboBox for this
look and feel. |
java.awt.Dimension |
getPreferredSize(javax.swing.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
BasicLookAndFeel
for this JComboBox. |
protected void |
installKeyboardActions()
Installs the keyboard actions for the
JComboBox as specified
by the look and feel. |
protected void |
installListeners()
Creates and installs the listeners for this UI.
|
void |
installUI(javax.swing.JComponent c)
Installs the UI for the given
JComponent. |
boolean |
isFocusTraversable(javax.swing.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(javax.swing.JComboBox c)
Returns
true if the popup is visible, and false
otherwise. |
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
Paints given menu item using specified graphics context
|
void |
paintCurrentValue(java.awt.Graphics g,
java.awt.Rectangle bounds,
boolean hasFocus)
Paints currently selected value in the main part of the combo
box (part without popup).
|
void |
paintCurrentValueBackground(java.awt.Graphics g,
java.awt.Rectangle bounds,
boolean hasFocus)
Paints the background of part of the combo box, where currently
selected value is displayed.
|
protected java.awt.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(javax.swing.JComboBox c,
boolean v)
Displays/hides the
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
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
JComboBox there were
installed by in installListeners(). |
protected void |
uninstallListeners()
Detaches all the listeners we attached in
installListeners(). |
void |
uninstallUI(javax.swing.JComponent c)
Uninstalls the UI for the given
JComponent. |
protected javax.swing.JButton arrowButton
protected javax.swing.JComboBox comboBox
protected java.awt.Component editor
protected java.awt.event.FocusListener focusListener
JComboBox.protected boolean hasFocus
protected java.awt.event.ItemListener itemListener
JComboBox.protected java.awt.event.KeyListener keyListener
JComboBox has
the focus.protected javax.swing.JList listBox
protected javax.swing.event.ListDataListener listDataListener
protected ComboPopup popup
protected java.awt.event.KeyListener popupKeyListener
protected java.awt.event.MouseListener popupMouseListener
protected java.awt.event.MouseMotionListener popupMouseMotionListener
protected java.beans.PropertyChangeListener propertyChangeListener
protected javax.swing.CellRendererPane currentValuePane
protected java.awt.Dimension cachedMinimumSize
protected boolean isMinimumSizeDirty
public BasicComboBoxUI()
BasicComboBoxUI object.public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
JComponent, which should be a JComboBox.c - The JComponent a UI is being created for.JComponent.public void installUI(javax.swing.JComponent c)
JComponent.installUI in class javax.swing.plaf.ComponentUIc - the JComponent to install a UI for.uninstallUI(JComponent)public void uninstallUI(javax.swing.JComponent c)
JComponent.uninstallUI in class javax.swing.plaf.ComponentUIc - The JComponent that is having this UI removed.installUI(JComponent)protected void installDefaults()
BasicLookAndFeel
for this JComboBox.uninstallDefaults()protected void installListeners()
uninstallListeners()protected void uninstallDefaults()
null.installDefaults()protected void uninstallListeners()
installListeners().installListeners()protected ComboPopup createPopup()
protected java.awt.event.KeyListener createKeyListener()
KeyListener to listen to key events.protected java.awt.event.FocusListener createFocusListener()
FocusListener that will listen to changes in this
JComboBox's focus.protected javax.swing.event.ListDataListener createListDataListener()
ListDataListener to listen to the combo box's data model.protected java.awt.event.ItemListener createItemListener()
ItemListener that will listen to the changes in
the JComboBox's selection.protected java.beans.PropertyChangeListener createPropertyChangeListener()
PropertyChangeListener to listen to the changes in
the JComboBox's bound properties.protected java.awt.LayoutManager createLayoutManager()
protected javax.swing.ListCellRenderer createRenderer()
protected javax.swing.ComboBoxEditor createEditor()
protected void installComponents()
protected void uninstallComponents()
JComboBox.installComponents()public void addEditor()
public void removeEditor()
protected void configureEditor()
protected void unconfigureEditor()
public void configureArrowButton()
configureArrowButton()public void unconfigureArrowButton()
configureArrowButton()protected javax.swing.JButton createArrowButton()
JComboBox. The arrow button is
displayed at the right end of the combo box and is used to display/hide
the drop down list of items.public boolean isPopupVisible(javax.swing.JComboBox c)
true if the popup is visible, and false
otherwise.isPopupVisible in class javax.swing.plaf.ComboBoxUIc - The JComboBox to checktrue if popup part of the JComboBox is visible and
false otherwise.public void setPopupVisible(javax.swing.JComboBox c, boolean v)
JComboBox's list of items on the screen.setPopupVisible in class javax.swing.plaf.ComboBoxUIc - The combo box, for which list of items should be
displayed/hiddenv - true if show popup part of the jcomboBox and false to hide.public boolean isFocusTraversable(javax.swing.JComboBox c)
isFocusTraversable in class javax.swing.plaf.ComboBoxUIc - combo box for which to check whether it is focus traversablepublic void paint(java.awt.Graphics g, javax.swing.JComponent c)
paint in class javax.swing.plaf.ComponentUIg - The graphics context used to paint this combo boxc - comboBox which needs to be painted.public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize in class javax.swing.plaf.ComponentUIc - comboBox for which to get preferred sizepublic java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
JComboBox for this
look and feel. Also makes sure cachedMinimimSize is setup correctly.getMinimumSize in class javax.swing.plaf.ComponentUIc - The JComponent to find the minimum size for.public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
JComboBox for this
look and feel.getMaximumSize in class javax.swing.plaf.ComponentUIc - The JComponent to find the maximum size forDimension(32767, 32767)).public int getAccessibleChildrenCount(javax.swing.JComponent c)
getAccessibleChildrenCount in class javax.swing.plaf.ComponentUIc - the component (combobox) to check, ignoredpublic javax.accessibility.Accessible getAccessibleChild(javax.swing.JComponent c, int i)
getAccessibleChild in class javax.swing.plaf.ComponentUIc - the component, this is ignoredi - the index of the accessible child to returnprotected boolean isNavigationKey(int keyCode)
keyCode - a key for which to check whether it is navigation key or
not.protected void selectNextPossibleValue()
protected void selectPreviousPossibleValue()
protected void toggleOpenClose()
protected java.awt.Rectangle rectangleForCurrentValue()
protected java.awt.Insets getInsets()
public void paintCurrentValue(java.awt.Graphics g, java.awt.Rectangle bounds, boolean hasFocus)
g - graphics contextbounds - Rectangle representing the size of the area in which
selected item should be drawnhasFocus - true if combo box has focus and false otherwisepublic void paintCurrentValueBackground(java.awt.Graphics g, java.awt.Rectangle bounds, boolean hasFocus)
g - graphics contextbounds - Rectangle representing the size of the largest item in the
comboBoxhasFocus - true if combo box has fox and false otherwiseprotected java.awt.Dimension getDefaultSize()
getDisplaySize()protected java.awt.Dimension getDisplaySize()
protected void installKeyboardActions()
JComboBox as specified
by the look and feel.protected void uninstallKeyboardActions()
JComboBox there were
installed by in installListeners().