Lists
You will recall that in the SELECT
widget in HTML programming, you could select how many choices
were visible at any one time using the SIZE attribute. Well,
since the Choice widget does not have such an attribute, you
need to use a different component if you want that
functionality. In the JDK, the List component is used for such
circumstances.
import java.awt.*;
public class ListExample
{
public static void main(String[] args)
{
Frame baseFrame = new Frame();
baseFrame.reshape(10,10,200,200);
baseFrame.setTitle("List Example");
List list = new List(3, true);
list.addItem("Selena");
list.addItem("Eric");
list.addItem("Mark");
list.addItem("Bob Frog");
baseFrame.add(list);
baseFrame.show();
}
}

NEXT
Selena Sol contributes to the JavaBoutique's Introduction to Java. Selena currently works for Barclays Capital in London, one of the leading global investment banks in Europe and has worked as a software developer for the National Center for Human Genome research, Microline Software, Neuron Data, and Electric Eye in Singapore. Selena is perhaps best-known for creating the Public Domain Web Script Archive (Extropia) and writing several books on Web Programming (Perl, CGI, Java).
Email: selena@extropia.com