|
|
`AwtTest' example program: displays AWT objects
AwtTest.java
/*=================================================================
AwtTest.java
Shows the appearance of the AWT componenets, and demonstrates
how the layout manager arranges components.
Kevin Boone, August 1999
=================================================================*/
import java.applet.Applet;
import java.awt.*;
/*=================================================================
AwtTest class
=================================================================*/
public class AwtTest extends Applet
{
public AwtTest ()
{
super ();
setSize (300, 300);
setLayout (new FlowLayout());
add (new Button ("Button"));
add (new Label ("Label"));
Choice choice = new Choice ();
choice.addItem("Choice");
add (choice);
List list = new List ();
list.add("List item 1");
list.add("List item 2");
add (list);
Canvas canvas = new Canvas();
canvas.setSize (50, 50);
add (canvas);
add (new Checkbox ("CheckBox"));
TextArea textArea = new TextArea ("TextArea", 5, 30);
add (textArea);
TextField textField = new TextField ("TextField");
add (textField);
}
}
|