import java.applet.Applet; import java.awt.*; public class GridLayout1 extends Applet { private Button button1, button2, button3, button4, button5, button6; private TextField display; public void init() { setLayout(new BorderLayout()); display = new TextField(20); display.setEditable(false); Panel buttonsPanel = new Panel(); button1 = new Button("Button 1"); button2 = new Button("Button 2"); button3 = new Button("Button 3"); button4 = new Button("Button 4"); button5 = new Button("Button 5"); button6 = new Button("Button 6"); buttonsPanel.setLayout(new GridLayout(3,2)); buttonsPanel.add(button1); buttonsPanel.add(button2); buttonsPanel.add(button3); buttonsPanel.add(button4); buttonsPanel.add(button5); buttonsPanel.add(button6); add("North", display); add("Center", buttonsPanel); } public boolean action(Event evt, Object arg) { if (arg instanceof String) { String s = (String)arg; display.setText(s); } else return super.action(evt, arg); return true; } }