Articles : JavaBoutique's Introduction to Java :
Components :

Contents
Introduction
Static Text with Label
Text Entry Components
Check Boxes and Check Box Groups
Choices
Lists
Menus and Menu Bars
Scrollbars, Buttons, and Canvases

Choices

One of the problems with Check Boxes and Check Box Groups is that they take up a lot of space in your interface. If you have a lot of choices, it may be better to present them in a Choice control (similar to the SELECT widget in HTML FORM programming)

import java.awt.*;

public class ChoiceExample
  {
  public static void main(String[] args)
    {
    Frame baseFrame = new Frame();
    baseFrame.setLayout(new GridLayout(4,1));
    baseFrame.reshape(10,10,200,200);
    baseFrame.setTitle("Choice Example");

    Choice choice = new Choice();
    choice.addItem("Selena");
    choice.addItem("Eric");
    choice.addItem("Mark");


    baseFrame.add(choice);

    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