|
Swing 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.plaf.ComponentUI | +--javax.swing.plaf.ComboBoxUI | +--javax.swing.plaf.basic.BasicComboBoxUI
Basic UI for JComboBox. This class adds and removes components from the JComboBox. The arrow button and the editor are managed by this object. The popup menu is handled by BasicComboPopup. BasicComboPopup supplies this class with a MouseListener, MouseMotionListener, and a KeyListener. These listeners are added to the arrow button and the JComboBox by default. Subclasses of BasicComboBoxUI should attach the listeners to whichever components they like. installListeners() is where listeners get added to the JComboBox (and model). configureEditor() is where listeners get added to the editor. configureArrowButton() is where listeners get added to the arrow button. Inner classes for handling events: FocusHandler ItemHandler ListDataHandler PropertyChangeHandler KeyHandler
Inner Class Summary | |
class |
BasicComboBoxUI.ComboBoxLayoutManager
This layout manager handles the 'standard' layout of combo boxes. |
class |
BasicComboBoxUI.FocusHandler
This listener hides the popup when the focus is lost. |
class |
BasicComboBoxUI.ItemHandler
This listener watches for changes to the selection in the combo box and updates the display of the currently selected item. |
class |
BasicComboBoxUI.KeyHandler
This listener checks to see if the key event isn't a navigation key. |
class |
BasicComboBoxUI.ListDataHandler
This listener watches for changes in the data and revalidates. |
class |
BasicComboBoxUI.PropertyChangeHandler
This listener watches for bound properties that have changed in the JComboBox. |
Field Summary | |
protected JButton |
arrowButton
|
protected java.awt.Dimension |
cachedMinimumSize
|
protected JComboBox |
comboBox
|
protected CellRendererPane |
currentValuePane
|
protected java.awt.Component |
editor
|
protected java.awt.event.FocusListener |
focusListener
|
protected boolean |
hasFocus
|
protected boolean |
isMinimumSizeDirty
|
protected java.awt.event.ItemListener |
itemListener
|
protected java.awt.event.KeyListener |
keyListener
|
protected JList |
listBox
|
protected 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
|
Constructor Summary | |
BasicComboBoxUI()
|
Method Summary | |
void |
addEditor()
Adds the editor to the JComboBox. |
void |
configureArrowButton()
Configures the arrow button by adding listeners. |
protected void |
configureEditor()
Configures the editor by setting its font and adding listeners. |
protected JButton |
createArrowButton()
Creates the arrow button. |
protected ComboBoxEditor |
createEditor()
Creates the editor that is to be used in editable combo boxes. |
protected java.awt.event.FocusListener |
createFocusListener()
Creates the focus listener that hides the popup when the focus is lost. |
protected java.awt.event.ItemListener |
createItemListener()
Creates the item listener that watches for updates in the current selection so that it can update the display. |
protected java.awt.event.KeyListener |
createKeyListener()
Creates the key listener for handling type-ahead. |
protected java.awt.LayoutManager |
createLayoutManager()
Creates the standard combo box layout manager that has the arrow button to the right and the editor to the left. |
protected ListDataListener |
createListDataListener()
Creates the list data listener that is used for caching the preferred sizes. |
protected ComboPopup |
createPopup()
Creates an implementation of the ComboPopup interface. |
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
Creates the list data listener that is used for caching the preferred sizes. |
protected ListCellRenderer |
createRenderer()
Creates the renderer that is to be used in the combo box. |
static ComponentUI |
createUI(JComponent c)
|
Accessible |
getAccessibleChild(JComponent c,
int i)
|
int |
getAccessibleChildrenCount(JComponent c)
|
protected java.awt.Dimension |
getDefaultSize()
Return the dimension the the combo box should have if by default if there is no current value and no value in the list of possible values. |
protected java.awt.Dimension |
getDisplaySize()
|
protected java.awt.Insets |
getInsets()
Gets the insets from the JComboBox. |
java.awt.Dimension |
getMaximumSize(JComponent c)
|
java.awt.Dimension |
getMinimumSize(JComponent c)
|
java.awt.Dimension |
getPreferredSize(JComponent c)
|
protected void |
installComponents()
The editor and arrow button are added to the JComboBox here. |
protected void |
installDefaults()
Installs the default colors, default font, default renderer, and default editor into the JComboBox. |
protected void |
installKeyboardActions()
Adds keyboard actions to the JComboBox. |
protected void |
installListeners()
Attaches listeners to the JComboBox and JComboBoxModel. |
void |
installUI(JComponent c)
|
boolean |
isFocusTraversable(JComboBox c)
Determines if the JComboBox is focus traversable. |
protected boolean |
isNavigationKey(int keyCode)
Returns whether or not the supplied keyCode maps to a key that is used for navigation. |
boolean |
isPopupVisible(JComboBox c)
Tells if the popup is visible or not. |
void |
paint(java.awt.Graphics g,
JComponent c)
|
void |
paintCurrentValue(java.awt.Graphics g,
java.awt.Rectangle bounds,
boolean hasFocus)
Paints the currently selected item. |
void |
paintCurrentValueBackground(java.awt.Graphics g,
java.awt.Rectangle bounds,
boolean hasFocus)
Paints the background of the currently selected item. |
protected java.awt.Rectangle |
rectangleForCurrentValue()
Returns the area that is reserved for drawing the currently selected item. |
void |
removeEditor()
Removes the editor from the JComboBox. |
protected void |
selectNextPossibleValue()
Selects the next item in the list. |
protected void |
selectPreviousPossibleValue()
Selects the previous item in the list. |
void |
setPopupVisible(JComboBox c,
boolean v)
Hides the popup. |
protected void |
toggleOpenClose()
Hides the popup if it is showing and shows the popup if it is hidden. |
void |
unconfigureArrowButton()
Unconfigures the arrow button by removing listeners. |
protected void |
unconfigureEditor()
Unconfigures the editor by removing listeners. |
protected void |
uninstallComponents()
The editor and/or arrow button are removed from the JComboBox here. |
protected void |
uninstallDefaults()
Uninstalls the default colors, default font, default renderer, and default editor into the JComboBox. |
protected void |
uninstallKeyboardActions()
Removes the keyboard actions that were added by installKeyboardActions(). |
protected void |
uninstallListeners()
Removes listeners from the JComboBox and JComboBoxModel. |
void |
uninstallUI(JComponent c)
|
Methods inherited from class javax.swing.plaf.ComponentUI |
contains,
update |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected JComboBox comboBox
protected boolean hasFocus
protected JList listBox
protected CellRendererPane currentValuePane
protected ComboPopup popup
protected java.awt.Component editor
protected JButton arrowButton
protected java.awt.event.KeyListener keyListener
protected java.awt.event.FocusListener focusListener
protected java.awt.event.ItemListener itemListener
protected java.beans.PropertyChangeListener propertyChangeListener
protected java.awt.event.MouseListener popupMouseListener
protected java.awt.event.MouseMotionListener popupMouseMotionListener
protected java.awt.event.KeyListener popupKeyListener
protected ListDataListener listDataListener
protected boolean isMinimumSizeDirty
protected java.awt.Dimension cachedMinimumSize
Constructor Detail |
public BasicComboBoxUI()
Method Detail |
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
public void uninstallUI(JComponent c)
protected void installDefaults()
protected void installListeners()
protected void uninstallDefaults()
protected void uninstallListeners()
protected ComboPopup createPopup()
protected java.awt.event.KeyListener createKeyListener()
protected java.awt.event.FocusListener createFocusListener()
protected ListDataListener createListDataListener()
protected java.awt.event.ItemListener createItemListener()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected java.awt.LayoutManager createLayoutManager()
protected ListCellRenderer createRenderer()
protected ComboBoxEditor createEditor()
protected void installComponents()
protected void uninstallComponents()
public void addEditor()
public void removeEditor()
protected void configureEditor()
protected void unconfigureEditor()
public void configureArrowButton()
public void unconfigureArrowButton()
protected JButton createArrowButton()
public boolean isPopupVisible(JComboBox c)
public void setPopupVisible(JComboBox c, boolean v)
public boolean isFocusTraversable(JComboBox c)
public void paint(java.awt.Graphics g, JComponent c)
public java.awt.Dimension getPreferredSize(JComponent c)
public java.awt.Dimension getMinimumSize(JComponent c)
public java.awt.Dimension getMaximumSize(JComponent c)
public int getAccessibleChildrenCount(JComponent c)
public Accessible getAccessibleChild(JComponent c, int i)
protected boolean isNavigationKey(int keyCode)
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)
public void paintCurrentValueBackground(java.awt.Graphics g, java.awt.Rectangle bounds, boolean hasFocus)
protected java.awt.Dimension getDefaultSize()
protected java.awt.Dimension getDisplaySize()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
|
Swing 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |