13.18. List Boxes

List boxes present scrolling lists from which the user can select an item (single-selectable lists) or several items (multiple-selectable lists). As with Choice menus, you first create an empty list, then add items to it through add, as below:

List list = new List();
list.addItem("...");
list.addItem("...");
...
add(list);

Constructors

The List class has three constructors.

public List()

public List(int rows)

public List(int rows, boolean multiSelectable)

The first constructor creates a single-selectable list box with a platform-dependent number of rows and a platform-dependent width. The second constructor creates a single-selectable list box with the specified number of rows and a platform-dependent width.

The last constructor ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.