Spec-Zone .ru
спецификации, руководства, описания, API
|
|
JavaTM 2 Platform Standard Edition |
|||||||||
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 Dimension |
cachedMinimumSize
|
protected JComboBox |
comboBox
|
protected CellRendererPane |
currentValuePane
|
protected Component |
editor
|
protected FocusListener |
focusListener
|
protected boolean |
hasFocus
|
protected boolean |
isMinimumSizeDirty
|
protected ItemListener |
itemListener
|
protected KeyListener |
keyListener
|
protected JList |
listBox
|
protected ListDataListener |
listDataListener
|
protected ComboPopup |
popup
|
protected KeyListener |
popupKeyListener
|
protected MouseListener |
popupMouseListener
|
protected MouseMotionListener |
popupMouseMotionListener
|
protected 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 FocusListener |
createFocusListener()
Creates the focus listener that hides the popup when the focus is lost. |
protected ItemListener |
createItemListener()
Creates the item listener that watches for updates in the current selection so that it can update the display. |
protected KeyListener |
createKeyListener()
Creates the key listener for handling type-ahead. |
protected 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 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)
Return the nth Accessible child of the object. |
int |
getAccessibleChildrenCount(JComponent c)
Returns the number of accessible children in the object. |
protected Dimension |
getDefaultSize()
Return the default size of an empty combo box. |
protected Dimension |
getDisplaySize()
|
protected Insets |
getInsets()
Gets the insets from the JComboBox. |
Dimension |
getMaximumSize(JComponent c)
|
Dimension |
getMinimumSize(JComponent c)
|
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(Graphics g,
JComponent c)
|
void |
paintCurrentValue(Graphics g,
Rectangle bounds,
boolean hasFocus)
Paints the currently selected item. |
void |
paintCurrentValueBackground(Graphics g,
Rectangle bounds,
boolean hasFocus)
Paints the background of the currently selected item. |
protected 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 Component editor
protected JButton arrowButton
protected KeyListener keyListener
protected FocusListener focusListener
protected ItemListener itemListener
protected PropertyChangeListener propertyChangeListener
protected MouseListener popupMouseListener
protected MouseMotionListener popupMouseMotionListener
protected KeyListener popupKeyListener
protected ListDataListener listDataListener
protected boolean isMinimumSizeDirty
protected 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 KeyListener createKeyListener()
protected FocusListener createFocusListener()
protected ListDataListener createListDataListener()
protected ItemListener createItemListener()
protected PropertyChangeListener createPropertyChangeListener()
protected 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(Graphics g, JComponent c)
public Dimension getPreferredSize(JComponent c)
public Dimension getMinimumSize(JComponent c)
public Dimension getMaximumSize(JComponent c)
public int getAccessibleChildrenCount(JComponent c)
ComponentUI.getAccessibleChild(javax.swing.JComponent, int)
public Accessible getAccessibleChild(JComponent c, int i)
i
- zero-based index of childComponentUI.getAccessibleChildrenCount(javax.swing.JComponent)
protected boolean isNavigationKey(int keyCode)
protected void selectNextPossibleValue()
protected void selectPreviousPossibleValue()
protected void toggleOpenClose()
protected Rectangle rectangleForCurrentValue()
protected Insets getInsets()
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
protected Dimension getDefaultSize()
protected Dimension getDisplaySize()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |