|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.zfqjava.swing.AComboBox
public class AComboBox
AComboBox provides a another combo box.
| Nested Class Summary | |
|---|---|
static class |
AComboBox.AbstractComponentFactory
|
protected class |
AComboBox.AccessibleAComboBox
This class implements accessibility support for the AComboBox class. |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
AComboBox()
Constructs a combobox. |
|
| Method Summary | |
|---|---|
void |
addActionListener(ActionListener l)
Adds an ActionListener. |
void |
addPopupMenuListener(PopupMenuListener l)
Adds a PopupMenu listener which will listen to notification
messages from the popup portion of the combo box. |
protected JPopupMenu |
createPopupMenu()
Creates the JPopupMenu for the popup component. |
protected void |
fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
firePopupMenuCanceled()
Notifies PopupMenuListeners that the popup portion of the
combo box has been canceled. |
protected void |
firePopupMenuWillBecomeInvisible()
Notifies PopupMenuListeners that the popup portion of the
combo box has become invisible. |
protected void |
firePopupMenuWillBecomeVisible()
Notifies PopupMenuListeners that the popup portion of the
combo box will become visible. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this AComboBox. |
ActionListener[] |
getActionListeners()
Returns an array of all the ActionListeners added
to this JComboBox with addActionListener(). |
AComboBox.AbstractComponentFactory |
getComponentFactory()
|
ComboBoxEditor |
getEditor()
Returns the editor used to paint and edit the selected item in the JComboBox field. |
Component |
getPopupComponent()
Returns the popup component added into JPopupMenu. |
Icon |
getPopupIcon()
Returns the popup icon used for the drop down button icon. |
JPopupMenu |
getPopupMenu()
Returns the popup menu. |
PopupMenuListener[] |
getPopupMenuListeners()
Returns an array of all the PopupMenuListeners added
to this JComboBox with addPopupMenuListener(). |
protected Point |
getPopupMenuOrigin()
Computes the origin for the AComboBox's popup menu. |
Renderer |
getRenderer()
Returns the renderer used to display the selected item in the JComboBox field. |
Object |
getValue()
Returns the value for the AComboBox. |
Class |
getValueClass()
Returns the value type. |
void |
hidePopup()
Causes the combo box to close its popup window. |
boolean |
isEditable()
Returns true if the JComboBox is editable. |
boolean |
isLightWeightPopupEnabled()
Gets the value of the lightWeightPopupEnabled
property. |
boolean |
isPopupVisible()
Determines the visibility of the popup. |
protected void |
paintBorder(Graphics g)
|
protected void |
paintComponent(Graphics g)
|
protected String |
paramString()
Returns a string representation of this AComboBox. |
void |
processKeyEvent(KeyEvent e)
Handles KeyEvents, looking for the Tab key. |
void |
removeActionListener(ActionListener l)
Removes an ActionListener. |
void |
removePopupMenuListener(PopupMenuListener l)
Removes a PopupMenuListener. |
void |
setComponentFactory(AComboBox.AbstractComponentFactory componentFactory)
|
void |
setEditable(boolean aFlag)
Determines whether the JComboBox field is editable. |
void |
setEditor(ComboBoxEditor anEditor)
Sets the editor used to paint and edit the selected item in the JComboBox field. |
void |
setLightWeightPopupEnabled(boolean aFlag)
Sets the lightWeightPopupEnabled property, which
provides a hint as to whether or not a lightweight
Component should be used to contain the
JComboBox, versus a heavyweight
Component such as a Panel
or a Window. |
void |
setPopupComponent(Component popupComponent)
Sets the popup component added into JPopupMenu. |
void |
setPopupIcon(Icon popupIcon)
Sets the popup icon used for the drop down button icon. |
void |
setPopupMenu(JPopupMenu popupMenu)
Sets the popup menu. |
void |
setPopupVisible(boolean v)
Sets the visibility of the popup. |
void |
setRenderer(Renderer aRenderer)
Sets the renderer that paints the list items and the item selected from the list in the JComboBox field. |
void |
setValue(Object value)
Sets the value for the AComboBox. |
void |
setValueClass(Class valueClass)
Sets the value class, the AComboBox will configure the AbstractComponentFactory based the value class. |
void |
showPopup()
Causes the combo box to display its popup window. |
void |
updateUI()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AComboBox()
| Method Detail |
|---|
public void updateUI()
updateUI in class JComponentprotected void paintBorder(Graphics g)
paintBorder in class JComponentpublic void setValue(Object value)
AComboBox.
value - the value for the AComboBoxgetValue()public Object getValue()
AComboBox.
AComboBoxsetValue(java.lang.Object)public Class getValueClass()
public void setValueClass(Class valueClass)
valueClass - the value typepublic void setLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled property, which
provides a hint as to whether or not a lightweight
Component should be used to contain the
JComboBox, versus a heavyweight
Component such as a Panel
or a Window. The decision of lightweight
versus heavyweight is ultimately up to the
JComboBox. Lightweight windows are more
efficient than heavyweight windows, but lightweight
and heavyweight components do not mix well in a GUI.
If your application mixes lightweight and heavyweight
components, you should disable lightweight popups.
The default value for the lightWeightPopupEnabled
property is true, unless otherwise specified
by the look and feel. Some look and feels always use
heavyweight popups, no matter what the value of this property.
See the article Mixing Heavy and Light Components on The Swing Connection This method fires a property changed event.
aFlag - if true, lightweight popups are desiredpublic boolean isLightWeightPopupEnabled()
lightWeightPopupEnabled
property.
lightWeightPopupEnabled
propertysetLightWeightPopupEnabled(boolean)public void setEditable(boolean aFlag)
JComboBox field is editable.
An editable JComboBox allows the user to type into the
field or selected an item from the list to initialize the field,
after which it can be edited. (The editing affects only the field,
the list item remains intact.) A non editable JComboBox
displays the selected item in the field,
but the selection cannot be modified.
aFlag - a boolean value, where true indicates that the
field is editablepublic boolean isEditable()
JComboBox is editable.
By default, a combo box is not editable.
JComboBox is editable, else falsepublic void setRenderer(Renderer aRenderer)
The default renderer displays a string or an icon. Other renderers can handle graphic images and composite items.
To display the selected item,
aRenderer.setValue
is called, passing the object.
aRenderer - the Renderer that
displays the selected itemsetEditor(javax.swing.ComboBoxEditor)public Renderer getRenderer()
JComboBox field.
ListCellRenderer that displays
the selected item.public void setEditor(ComboBoxEditor anEditor)
JComboBox field. The editor is used only if the
receiving JComboBox is editable. If not editable,
the combo box uses the renderer to paint the selected item.
anEditor - the ComboBoxEditor that
displays the selected itemsetRenderer(javax.swing.Renderer)public ComboBoxEditor getEditor()
JComboBox field.
ComboBoxEditor that displays the selected itempublic void setPopupIcon(Icon popupIcon)
popupIcon - the popup icon used for the drop down button icongetPopupIcon()public Icon getPopupIcon()
public void setPopupComponent(Component popupComponent)
popupComponent - the popup component added into JPopupMenupublic Component getPopupComponent()
public AComboBox.AbstractComponentFactory getComponentFactory()
public void setComponentFactory(AComboBox.AbstractComponentFactory componentFactory)
protected JPopupMenu createPopupMenu()
protected Point getPopupMenuOrigin()
AComboBox's popup menu.
Point in the coordinate space of the
menu which should be used as the origin
of the AComboBox's popup menupublic void setPopupMenu(JPopupMenu popupMenu)
popupMenu - the popup menugetPopupMenu()public JPopupMenu getPopupMenu()
setPopupMenu(javax.swing.JPopupMenu)public void showPopup()
setPopupVisible(boolean)public void hidePopup()
setPopupVisible(boolean)public void setPopupVisible(boolean v)
public boolean isPopupVisible()
protected void paintComponent(Graphics g)
paintComponent in class JComponentpublic void addActionListener(ActionListener l)
ActionListener.
The ActionListener will receive an ActionEvent
when a selection has been made. If the combo box is editable, then
an ActionEvent will be fired when editing has stopped.
l - the ActionListener that is to be notified#setSelectedItempublic void removeActionListener(ActionListener l)
ActionListener.
l - the ActionListener to removepublic ActionListener[] getActionListeners()
ActionListeners added
to this JComboBox with addActionListener().
ActionListeners added or an empty
array if no listeners have been addedprotected void fireActionPerformed(ActionEvent e)
e - the action event to fireEventListenerListpublic void addPopupMenuListener(PopupMenuListener l)
PopupMenu listener which will listen to notification
messages from the popup portion of the combo box.
For all standard look and feels shipped with Java 2, the popup list
portion of combo box is implemented as a JPopupMenu.
A custom look and feel may not implement it this way and will
therefore not receive the notification.
l - the PopupMenuListener to addpublic void removePopupMenuListener(PopupMenuListener l)
PopupMenuListener.
l - the PopupMenuListener to removeaddPopupMenuListener(javax.swing.event.PopupMenuListener)public PopupMenuListener[] getPopupMenuListeners()
PopupMenuListeners added
to this JComboBox with addPopupMenuListener().
PopupMenuListeners added or an empty
array if no listeners have been addedprotected void firePopupMenuWillBecomeVisible()
PopupMenuListeners that the popup portion of the
combo box will become visible.
This method is public but should not be called by anything other than the UI delegate.
addPopupMenuListener(javax.swing.event.PopupMenuListener)protected void firePopupMenuWillBecomeInvisible()
PopupMenuListeners that the popup portion of the
combo box has become invisible.
This method is public but should not be called by anything other than the UI delegate.
addPopupMenuListener(javax.swing.event.PopupMenuListener)protected void firePopupMenuCanceled()
PopupMenuListeners that the popup portion of the
combo box has been canceled.
This method is public but should not be called by anything other than the UI delegate.
addPopupMenuListener(javax.swing.event.PopupMenuListener)public void processKeyEvent(KeyEvent e)
KeyEvents, looking for the Tab key.
If the Tab key is found, the popup window is closed.
processKeyEvent in class JComponente - the KeyEvent containing the keyboard
key that was pressedprotected String paramString()
null.
paramString in class JComponentpublic AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class JComponent
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||