|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbuoy.event.EventSource
buoy.widget.Widget
buoy.widget.BComboBox
public class BComboBox
A BComboBox is a Widget that displays a popup menu with a list of objects for the user to select. Typically the objects are Strings, but other types of objects can be used as well. Optionally, the combo box may be made editable, so the user may type a value directly rather than selecting one from the list. This allows arbitrary values to be entered, not just standard ones in the list.
BComboBox provides methods for adding and removing objects in the list. Alternatively, you can set a ComboBoxModel to provide more complex behaviors.
In addition to the event types generated by all Widgets, BComboBoxes generate the following event types:
Constructor Summary | |
---|---|
BComboBox()
Create a new uneditable BComboBox containing no objects. |
|
BComboBox(java.util.Collection contents)
Create a new uneditable BComboBox containing the objects in a Collection. |
|
BComboBox(javax.swing.ComboBoxModel model)
Create a new uneditable BComboBox whose contents are determined by a ComboBoxModel. |
|
BComboBox(java.lang.Object[] contents)
Create a new uneditable BComboBox containing the objects in an array. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object o)
Add an object at specified position in the middle of the list. |
void |
add(java.lang.Object o)
Add an object to the end of the list. |
javax.swing.JComboBox |
getComponent()
Get the java.awt.Component corresponding to this Widget. |
java.lang.Object |
getItem(int index)
Get the item at a specific position in the list. |
int |
getItemCount()
Get the number of items in the combo box's list. |
javax.swing.ComboBoxModel |
getModel()
Get the ComboBoxModel which controls the contents of this BComboBox. |
int |
getPreferredVisibleRows()
Get the preferred number of rows which should be visible in the popup menu without using a scrollbar. |
int |
getSelectedIndex()
Get the index of the selected item. |
java.lang.Object |
getSelectedValue()
Get the current value which has been selected from the list or, if this is an editable combo box, typed into the box. |
boolean |
isEditable()
Get whether this combo box is editable, allowing the user to type in values other than those in the popup list. |
void |
remove(int index)
Remove an object from the list. |
void |
removeAll()
Remove all objects from the list. |
void |
replace(int index,
java.lang.Object o)
Replace the object at a specified position in the list with a new one. |
void |
setContents(java.util.Collection c)
Set the contents of the list to the objects in a Collection. |
void |
setContents(java.lang.Object[] o)
Set the contents of the list to the objects in an array. |
void |
setEditable(boolean editable)
Set whether this combo box is editable, allowing the user to type in values other than those in the popup list. |
void |
setModel(javax.swing.ComboBoxModel model)
Set the ComboBoxModel which controls the contents of this BComboBox. |
void |
setPreferredVisibleRows(int rows)
Get the preferred number of rows which should be visible in the popup menu without using a scrollbar. |
void |
setSelectedIndex(int index)
Select the item with the specified index. |
void |
setSelectedValue(java.lang.Object value)
Set the value shown in the combo box. |
Methods inherited from class buoy.widget.Widget |
---|
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible |
Methods inherited from class buoy.event.EventSource |
---|
addEventLink, addEventLink, removeEventLink |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BComboBox()
public BComboBox(java.lang.Object[] contents)
public BComboBox(java.util.Collection contents)
public BComboBox(javax.swing.ComboBoxModel model)
Method Detail |
---|
public javax.swing.JComboBox getComponent()
Widget
getComponent
in class Widget
public boolean isEditable()
public void setEditable(boolean editable)
public void setContents(java.lang.Object[] o)
o
- the objects to put in the combo box's listpublic void setContents(java.util.Collection c)
c
- the objects to put in the combo box's listpublic javax.swing.ComboBoxModel getModel()
public void setModel(javax.swing.ComboBoxModel model)
public void add(java.lang.Object o)
o
- the object to addpublic void add(int index, java.lang.Object o)
index
- the position at which to add the objecto
- the object to addpublic void replace(int index, java.lang.Object o)
index
- the position at which to set the objecto
- the new object to addpublic void remove(int index)
index
- the position from which to remove the objectpublic void removeAll()
public int getItemCount()
public java.lang.Object getItem(int index)
public int getPreferredVisibleRows()
public void setPreferredVisibleRows(int rows)
public int getSelectedIndex()
public void setSelectedIndex(int index)
public java.lang.Object getSelectedValue()
public void setSelectedValue(java.lang.Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |