|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object buoy.event.EventSource buoy.widget.Widget buoy.widget.BList
public class BList
A BList is a Widget that displays a list of objects for the user to select. Typically the objects are Strings, but other types of objects can be used as well. It supports both single and multiple selection modes. There are methods for adding and removing objects in the list. Alternatively, you can set a ListModel to provide more complex behaviors.
BList does not provide scrolling automatically. Normally, it is used inside a BScrollPane.
In addition to the event types generated by all Widgets, BLists generate the following event types:
Constructor Summary | |
---|---|
BList()
Create a new BList containing no objects. |
|
BList(java.util.Collection contents)
Create a new BList containing the objects in a Collection. |
|
BList(javax.swing.ListModel model)
Create a new BList whose contents are determined by a ListModel. |
|
BList(java.lang.Object[] contents)
Create a new BList 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. |
void |
clearSelection()
Deselect all objects in the list. |
javax.swing.JList |
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 list. |
java.awt.Dimension |
getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn. |
javax.swing.ListModel |
getModel()
Get the ListModel which controls the contents of this BList. |
int |
getPreferredVisibleRows()
Get the preferred number of rows which should be visible without using a scrollbar. |
int |
getSelectedIndex()
Get the index of the first selected object, or -1 if nothing is selected. |
int[] |
getSelectedIndices()
Get the indices of all selected objects, in increasing order. |
java.lang.Object |
getSelectedValue()
Get the first selected object, or null if nothing is selected. |
java.lang.Object[] |
getSelectedValues()
Get an array of all selected objects, in order of increasing index. |
boolean |
isMultipleSelectionEnabled()
Determine whether this list allows multiple objects to be selected. |
boolean |
isSelected(int index)
Determine whether a particular object in the list is selected. |
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 |
scrollToItem(int index)
Scroll the BList's parent BScrollPane to ensure that a particular list entry is visible. |
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 |
setModel(javax.swing.ListModel model)
Set the ListModel which controls the contents of this BList. |
void |
setMultipleSelectionEnabled(boolean multiple)
Set whether this list should allow multiple objects to be selected. |
void |
setPreferredVisibleRows(int rows)
Set the preferred number of rows which should be visible without using a scrollbar. |
void |
setSelected(int index,
boolean selected)
Set whether a particular object should be selected. |
Methods inherited from class buoy.widget.Widget |
---|
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, 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 BList()
public BList(java.lang.Object[] contents)
public BList(java.util.Collection contents)
public BList(javax.swing.ListModel model)
Method Detail |
---|
public javax.swing.JList getComponent()
Widget
getComponent
in class Widget
public void setContents(java.lang.Object[] o)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
o
- the objects to put in the listpublic void setContents(java.util.Collection c)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
c
- the objects to put in the listpublic void add(java.lang.Object o)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
o
- the object to addpublic void add(int index, java.lang.Object o)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
index
- the position at which to add the objecto
- the object to addpublic void replace(int index, java.lang.Object o)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
index
- the position at which to set the objecto
- the new object to addpublic void remove(int index)
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
index
- the position from which to remove the objectpublic void removeAll()
If you have set a custom model for this list, either by passing it to the constructor or by calling setModel(), this method has no effect.
public javax.swing.ListModel getModel()
public void setModel(javax.swing.ListModel model)
public int getItemCount()
public java.lang.Object getItem(int index)
public boolean isMultipleSelectionEnabled()
public void setMultipleSelectionEnabled(boolean multiple)
public int getPreferredVisibleRows()
public void setPreferredVisibleRows(int rows)
public boolean isSelected(int index)
public int getSelectedIndex()
public int[] getSelectedIndices()
public java.lang.Object getSelectedValue()
public java.lang.Object[] getSelectedValues()
public void clearSelection()
public void setSelected(int index, boolean selected)
public void scrollToItem(int index)
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class Widget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |