Button Test - increasing numbers
import java.awt.*;
public class ButtonTest extends Frame
{
Button h;
TextField t;
int value=0;
public ButtonTest ()
{
setTitle("ButtonTest");
add("North", new Label(""));
add("South", new Label(""));
add("East", new Label(""));
add("West", new Label(""));
Panel p = new Panel();
p.setLayout(new GridLayout(2,1));
p.add(t=new TextField());
p.add(h=new Button("Count From Zero"));
add("Center",p);
}
public boolean action (Event evt, Object obj)
{
if (evt.target.equals(h)) t.setText(t.getText()+value++ +" ");
return (super.action(evt,obj));
}
public static void main (String arg[])
{
ButtonTest hello = new ButtonTest();
hello.resize(500,150);
hello.show();
}
}