Java Reference
In-Depth Information
Sample Run: Figure 12-16 shows a sample run of the Welcome applet with check
boxes, a combo box, and radio buttons.
FIGURE 12-16
Welcome applet with check boxes, combo box, and radio buttons
JList
A list displays a number of items from which the user can select one or more items. This
section illustrates the use of a single selection list. The programming example at the end of
this chapter uses a multiple selection list. Table 12-13 shows some constructors and
methods of the
class
JList
.
TABLE 12-13
Some Constructors and Methods of the
class
JList
public
JList()
//Creates a JList with no items to select.
//Example: JList selectionList = new JList();
//
1
2
selectionList is created but has no selectable items.
public
JList(Vector<? extends E> v)
//Creates a JList to display the elements in the
//vector provided as an input parameter.
//Example: JList selectionList = new JList(v);
//
selectionList is a new list that lists the elements
//
contained in Vector v.
Search WWH ::
Custom Search