|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.ComboBoxUI
javax.swing.plaf.basic.BasicComboBoxUI
public class BasicComboBoxUI
A UI delegate for the JComboBox
component.
Nested Class Summary | |
---|---|
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 ItemEvent s 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 PropertyChangeEvent s fired by the 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 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 JComboBox . |
protected KeyListener |
keyListener
A listener listening to key events that occur while 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 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 FocusListener that will listen to changes in this
JComboBox's focus. |
protected ItemListener |
createItemListener()
Creates an ItemListener that will listen to the changes in
the JComboBox's selection. |
protected KeyListener |
createKeyListener()
Creates a KeyListener to listen to key events. |
protected LayoutManager |
createLayoutManager()
Creates and returns a layout manager for the combo box. |
protected 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 PropertyChangeListener |
createPropertyChangeListener()
Creates a 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 JComponent , which should be a 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 JComboBox for this
look and feel. |
Dimension |
getMinimumSize(JComponent c)
Returns the minimum size for this 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 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(JComponent c)
Installs the UI for the given 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 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(JComponent c)
Uninstalls the UI for the given JComponent . |
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 JButton arrowButton
protected JComboBox comboBox
protected Component editor
BasicComboBoxEditor.getEditorComponent()
protected FocusListener focusListener
JComboBox
.
protected boolean hasFocus
protected ItemListener itemListener
JComboBox
.
protected KeyListener keyListener
JComboBox
has
the focus.
protected JList listBox
protected ListDataListener listDataListener
protected ComboPopup popup
protected KeyListener popupKeyListener
protected MouseListener popupMouseListener
protected MouseMotionListener popupMouseMotionListener
protected PropertyChangeListener propertyChangeListener
protected CellRendererPane currentValuePane
protected Dimension cachedMinimumSize
protected boolean isMinimumSizeDirty
Constructor Detail |
---|
public BasicComboBoxUI()
BasicComboBoxUI
object.
Method Detail |
---|
public static ComponentUI createUI(JComponent c)
JComponent
, which should be a JComboBox
.
c
- The JComponent
a UI is being created for.
JComponent
.public void installUI(JComponent c)
JComponent
.
installUI
in class ComponentUI
c
- the JComponent to install a UI for.uninstallUI(JComponent)
public void uninstallUI(JComponent c)
JComponent
.
uninstallUI
in class ComponentUI
c
- 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 KeyListener createKeyListener()
KeyListener
to listen to key events.
protected FocusListener createFocusListener()
FocusListener
that will listen to changes in this
JComboBox's focus.
protected ListDataListener createListDataListener()
ListDataListener
to listen to the combo box's data model.
protected ItemListener createItemListener()
ItemListener
that will listen to the changes in
the JComboBox's selection.
protected PropertyChangeListener createPropertyChangeListener()
PropertyChangeListener
to listen to the changes in
the JComboBox's bound properties.
protected LayoutManager createLayoutManager()
protected ListCellRenderer createRenderer()
protected 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 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(JComboBox c)
true
if the popup is visible, and false
otherwise.
isPopupVisible
in class ComboBoxUI
c
- The JComboBox to check
true
if popup part of the JComboBox is visible and
false
otherwise.public void setPopupVisible(JComboBox c, boolean v)
JComboBox
's list of items on the screen.
setPopupVisible
in class ComboBoxUI
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.public boolean isFocusTraversable(JComboBox c)
isFocusTraversable
in class ComboBoxUI
c
- combo box for which to check whether it is focus traversable
public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
g
- The graphics context used to paint this combo boxc
- comboBox which needs to be painted.public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
- comboBox for which to get preferred size
public Dimension getMinimumSize(JComponent c)
JComboBox
for this
look and feel. Also makes sure cachedMinimimSize is setup correctly.
getMinimumSize
in class ComponentUI
c
- The JComponent
to find the minimum size for.
public Dimension getMaximumSize(JComponent c)
JComboBox
for this
look and feel.
getMaximumSize
in class ComponentUI
c
- The JComponent
to find the maximum size for
Dimension(32767, 32767)
).public int getAccessibleChildrenCount(JComponent c)
getAccessibleChildrenCount
in class ComponentUI
c
- the component (combobox) to check, ignored
public Accessible getAccessibleChild(JComponent c, int i)
getAccessibleChild
in class ComponentUI
c
- 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 Rectangle rectangleForCurrentValue()
protected Insets getInsets()
public void paintCurrentValue(Graphics g, 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(Graphics g, 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 Dimension getDefaultSize()
getDisplaySize()
protected Dimension getDisplaySize()
protected void installKeyboardActions()
JComboBox
as specified
by the look and feel.
protected void uninstallKeyboardActions()
JComboBox
there were
installed by in installListeners()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |