public class Ch17Ex10 extends Frame {

private Panel centerPan, southPan;

private Label centerLabel;

private Button btn1, btn2, btn3;

public Ch17Ex10() {

centerPan = new Panel(new GridBagLayout());

southPan = new Panel(new GridLayout(1, 3));

centerLabel = new Label("Hello!");

btn1 = new Button("btn1");

btn2 = new Button("btn2");

btn3 = new Button("btn3");

centerPan.add(centerLabel);

southPan.add(btn1);

southPan.add(btn2);

southPan.add(btn3);

this.add("Center", centerPan);

this.add("South", southPan);

this.addWindowListener(new WindowAdapter() {

@Override

public void windowClosing(WindowEvent e) {

dispose();

System.exit(0);

}

});

this.setSize(640, 480);

this.setVisible(true);

}