1 package sample.rmi; 2 3 import java.awt.*; 4 import java.awt.event.*; 5 6 public class AlertDialog extends Frame implements ActionListener { 7 private Label label; 8 AlertDialog()9 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 show(String message)22 public void show(String message) { 23 label.setText(message); 24 setVisible(true); 25 } 26 actionPerformed(ActionEvent e)27 public void actionPerformed(ActionEvent e) { 28 setVisible(false); 29 } 30 } 31