import java.awt.*; import java.awt.event.*; class InfoDialog extends Frame { protected Button ok; public InfoDialog(String title, String message) { this.setLayout (new BorderLayout(15, 15)); this.setFont(new Font("Dialog", Font.BOLD, 16)); this.setBackground(new Color(150, 150, 150)); this.setTitle(title); TextArea ta = new TextArea(message); ta.setEditable(false); this.add("Center", ta); Panel p = new Panel(); ok = new Button("OK"); p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15)); p.add(ok); this.add("South", p); resize(300, 210); } public boolean action(Event e, Object arg) { if (e.target == ok) { this.hide(); this.dispose(); return true; } else { return false; } } }