import java.awt.*; public class InfoDialog extends Dialog { protected Button button; protected MultiLineLabel label; public InfoDialog(Frame parent, String title, String message) { super(parent, title, false); this.setLayout(new BorderLayout(15, 15)); label = new MultiLineLabel(message, 20, 20); this.add("Center", label); button = new Button("Okay"); Panel p = new Panel(); p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15)); p.add(button); this.add("South", p); this.pack(); } public boolean action(Event e, Object arg) { if (e.target == button) { this.hide(); this.dispose(); return true; } else return false; } public boolean gotFocus(Event e, Object arg) { button.requestFocus(); return true; } public static void main(String[] args) { Frame f = new Frame("InfoDialog Test"); f.resize(100,100); f.show(); InfoDialog d = new InfoDialog(f, "About CG Java", "Written by Mark Hulber\n"+ "Copyright(c) 1996"); d.show(); } }