Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ComboBoxUI
javax.swing.plaf.basic.BasicComboBoxUI
public class BasicComboBoxUI
extends ComboBoxUI
JComboBox
component.
Nested Class Summary | |
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
Field Summary | |
protected JButton |
|
protected Dimension |
|
protected JComboBox |
|
protected CellRendererPane |
|
protected Component |
|
protected FocusListener |
|
protected boolean |
|
protected boolean |
|
protected ItemListener |
|
protected KeyListener |
|
protected JList |
|
protected ListDataListener |
|
protected ComboPopup |
|
protected KeyListener | |
protected MouseListener | |
protected MouseMotionListener | |
protected PropertyChangeListener |
|
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
protected void |
|
protected JButton |
|
protected ComboBoxEditor |
|
protected FocusListener |
|
protected ItemListener |
|
protected KeyListener |
|
protected LayoutManager |
|
protected ListDataListener |
|
protected ComboPopup |
|
protected PropertyChangeListener |
|
protected ListCellRenderer |
|
static ComponentUI |
|
Accessible |
|
int |
|
protected Dimension |
|
protected Dimension |
|
protected Insets |
|
Dimension |
|
Dimension |
|
Dimension |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
void |
|
boolean |
|
protected boolean |
|
boolean |
|
void |
|
void |
|
void |
|
protected Rectangle |
|
void |
|
protected void |
|
protected void |
|
void |
|
protected void |
|
void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
void |
|
Methods inherited from class javax.swing.plaf.ComboBoxUI | |
isFocusTraversable , isPopupVisible , setPopupVisible |
Methods inherited from class javax.swing.plaf.ComponentUI | |
contains , createUI , getAccessibleChild , getAccessibleChildrenCount , getMaximumSize , getMinimumSize , getPreferredSize , installUI , paint , uninstallUI , update |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected JButton arrowButton
The arrow button that is displayed in the right side of JComboBox. This button is used to hide and show combo box's list of items.
protected Dimension cachedMinimumSize
The current minimum size if isMinimumSizeDirty is false. Setup by getMinimumSize() and invalidated by the various listeners.
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 theJComboBox
.
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 theJComboBox
.
protected KeyListener keyListener
A listener listening to key events that occur whileJComboBox
has the focus.
protected JList listBox
List used when rendering selected item of the combo box. The selection and foreground colors for combo box renderer are configured from this list.
protected ListDataListener listDataListener
ListDataListener listening to JComboBox model
protected PropertyChangeListener propertyChangeListener
Listener listening to changes in the bound properties of JComboBox
public void configureArrowButton()
Configures the arrow button.
- See Also:
configureArrowButton()
protected JButton createArrowButton()
Creates an arrow button for thisJComboBox
. 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.
- Returns:
- A new button.
protected ComboBoxEditor createEditor()
Creates the component that will be responsible for displaying/editing the selected item in the combo box. This editor is used only when combo box is editable.
- Returns:
- A new component that will be responsible for displaying/editing the selected item in the combo box.
protected FocusListener createFocusListener()
Creates theFocusListener
that will listen to changes in this JComboBox's focus.
- Returns:
- the FocusListener.
protected ItemListener createItemListener()
Creates anItemListener
that will listen to the changes in the JComboBox's selection.
- Returns:
- The ItemListener
protected KeyListener createKeyListener()
Creates aKeyListener
to listen to key events.
- Returns:
- KeyListener that listens to key events.
protected LayoutManager createLayoutManager()
Creates and returns a layout manager for the combo box. Subclasses can override this method to provide a different layout.
- Returns:
- a layout manager for the combo box.
protected ListDataListener createListDataListener()
Creates aListDataListener
to listen to the combo box's data model.
- Returns:
- The new listener.
protected ComboPopup createPopup()
Creates the popup that will contain list of combo box's items.
- Returns:
- popup containing list of combo box's items
protected PropertyChangeListener createPropertyChangeListener()
Creates aPropertyChangeListener
to listen to the changes in the JComboBox's bound properties.
- Returns:
- The PropertyChangeListener
protected ListCellRenderer createRenderer()
Creates a component that will be responsible for rendering the selected component in the combo box.
- Returns:
- A renderer for the combo box.
public static ComponentUI createUI(JComponent c)
A factory method to create a UI delegate for the givenJComponent
, which should be aJComboBox
.
- Overrides:
- createUI in interface ComponentUI
- Parameters:
c
- TheJComponent
a UI is being created for.
- Returns:
- A UI delegate for the
JComponent
.
public Accessible getAccessibleChild(JComponent c, int i)
Returns the accessible child with the specified index.
- Overrides:
- getAccessibleChild in interface ComponentUI
- Parameters:
c
- the component, this is ignoredi
- the index of the accessible child to return
public int getAccessibleChildrenCount(JComponent c)
Returns the number of accessible children of the combobox.
- Overrides:
- getAccessibleChildrenCount in interface ComponentUI
- Parameters:
c
- the component (combobox) to check, ignored
- 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. This method returns the width and height of a single space in the current font, plus a margin of 1 pixel.
- Returns:
- The default display size.
- See Also:
getDisplaySize()
protected Dimension getDisplaySize()
Returns the size of the display area for the combo box. This size will be the size of the combo box, not including the arrowButton.
- Returns:
- The size of the display area for the combo box.
protected Insets getInsets()
Returns the insets of the current border.
- Returns:
- Insets representing space between combo box and its border
public Dimension getMaximumSize(JComponent c)
Returns the maximum size for thisJComboBox
for this look and feel.
- Overrides:
- getMaximumSize in interface ComponentUI
- Parameters:
c
- TheJComponent
to find the maximum size for
- Returns:
- The maximum size (
Dimension(32767, 32767)
).
public Dimension getMinimumSize(JComponent c)
Returns the minimum size for thisJComboBox
for this look and feel. Also makes sure cachedMinimimSize is setup correctly.
- Overrides:
- getMinimumSize in interface ComponentUI
- Parameters:
c
- TheJComponent
to find the minimum size for.
- Returns:
- The dimensions of the minimum size.
public Dimension getPreferredSize(JComponent c)
Returns preferred size for the combo box.
- Overrides:
- getPreferredSize in interface ComponentUI
- Parameters:
c
- comboBox for which to get preferred size
- Returns:
- The preferred size for the given combo box
protected void installComponents()
Installs the components for this JComboBox. ArrowButton, main part of combo box (upper part) and popup list of items are created and configured here.
protected void installDefaults()
Installs the defaults that are defined in theBasicLookAndFeel
for thisJComboBox
.
- See Also:
uninstallDefaults()
protected void installKeyboardActions()
Installs the keyboard actions for theJComboBox
as specified by the look and feel.
protected void installListeners()
Creates and installs the listeners for this UI.
- See Also:
uninstallListeners()
public void installUI(JComponent c)
Installs the UI for the givenJComponent
.
- Overrides:
- installUI in interface ComponentUI
- Parameters:
c
- the JComponent to install a UI for.
- See Also:
uninstallUI(JComponent)
public boolean isFocusTraversable(JComboBox c)
JComboBox is focus traversable if it is editable and not otherwise.
- Overrides:
- isFocusTraversable in interface ComboBoxUI
- Parameters:
c
- combo box for which to check whether it is focus traversable
- Returns:
- true if focus tranversable and false otherwise
protected boolean isNavigationKey(int keyCode)
Returns true if the specified key is a navigation key 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
public boolean isPopupVisible(JComboBox c)
Returnstrue
if the popup is visible, andfalse
otherwise.
- Overrides:
- isPopupVisible in interface ComboBoxUI
- Parameters:
c
- The JComboBox to check
- Returns:
true
if popup part of the JComboBox is visible andfalse
otherwise.
public void paint(Graphics g, JComponent c)
Paints given menu item using specified graphics context
- Overrides:
- paint in interface ComponentUI
- Parameters:
g
- The graphics context used to paint this combo boxc
- comboBox which needs to be painted.
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
Paints currently selected value in the main part of the combo box (part without popup).
- Parameters:
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 otherwise
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
Paints the background of part of the combo box, where currently selected value is displayed. If the combo box has focus this method should also paint focus rectangle around the combo box.
- Parameters:
g
- graphics contextbounds
- Rectangle representing the size of the largest item in the comboBoxhasFocus
- true if combo box has fox and false otherwise
protected Rectangle rectangleForCurrentValue()
Returns the bounds in which comboBox's selected item will be displayed.
- Returns:
- rectangle bounds in which comboBox's selected Item will be displayed
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.
public void setPopupVisible(JComboBox c, boolean v)
Displays/hides theJComboBox
's list of items on the screen.
- Overrides:
- setPopupVisible in interface ComboBoxUI
- Parameters:
c
- The combo box, for which list of items should be displayed/hiddenv
- true if show popup part of the jcomboBox and false to hide.
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
public void unconfigureArrowButton()
Unconfigures the arrow button.
- See Also:
configureArrowButton()
protected void uninstallComponents()
Uninstalls components from thisJComboBox
.
- See Also:
installComponents()
protected void uninstallDefaults()
Uninstalls the defaults and sets any objects created during install tonull
.
- See Also:
installDefaults()
protected void uninstallKeyboardActions()
Uninstalls the keyboard actions for theJComboBox
there were installed by ininstallListeners()
.
protected void uninstallListeners()
Detaches all the listeners we attached ininstallListeners()
.
- See Also:
installListeners()
public void uninstallUI(JComponent c)
Uninstalls the UI for the givenJComponent
.
- Overrides:
- uninstallUI in interface ComponentUI
- Parameters:
c
- The JComponent that is having this UI removed.
- See Also:
installUI(JComponent)