01: package sample.rmi;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05:
06: public class AlertDialog extends Frame implements ActionListener {
07: private Label label;
08:
09: public AlertDialog() {
10: super ("Alert");
11: setSize(200, 100);
12: setLocation(100, 100);
13: label = new Label();
14: Button b = new Button("OK");
15: b.addActionListener(this );
16: Panel p = new Panel();
17: p.add(b);
18: add("North", label);
19: add("South", p);
20: }
21:
22: public void show(String message) {
23: label.setText(message);
24: setVisible(true);
25: }
26:
27: public void actionPerformed(ActionEvent e) {
28: setVisible(false);
29: }
30: }
|