import java.applet.Applet; import java.awt.*; public class GridLayout2 extends Applet { private Button showDialog; private TextField status; private Label label; private TextArea address; MsgDialog msgDialog; String dialogTitle = "Dialog Box"; public void init() { setLayout(new GridLayout(2,2,20,20)); showDialog = new Button("Show Dialog Box"); status = new TextField(5); label = new Label("Another example of GridLayout"); String add = "Northeast Parallel Architectures Center (NPAC) \n" + "111 College Place, \n" + "Syracuse, NY 13244-4100"; address = new TextArea(add,4,35); address.setEditable(false); add(showDialog); add(status); add(label); add(address); } public boolean action(Event evt, Object arg) { if (arg.equals("Show Dialog Box")) { msgDialog = new MsgDialog(dialogTitle); } else return super.action(evt,arg); return true; } } class MsgDialog extends Frame { MsgDialog(String title) { super(title); Button okButton = new Button("OK"); setLayout(new FlowLayout()); add(okButton); resize(200,70); show(); } public boolean action(Event evt, Object arg) { if (arg.equals("OK")) { hide(); } else return super.action(evt,arg); return true; } }