/Users/lyon/j4p/src/javassist/sample/rmi/AlertDialog.java

1    package javassist.sample.rmi; 
2     
3    import java.awt.Button; 
4    import java.awt.Frame; 
5    import java.awt.Label; 
6    import java.awt.Panel; 
7    import java.awt.event.ActionEvent; 
8    import java.awt.event.ActionListener; 
9     
10   public class AlertDialog extends Frame implements ActionListener { 
11       private Label label; 
12    
13       public AlertDialog() { 
14           super("Alert"); 
15           setSize(200, 100); 
16           setLocation(100, 100); 
17           label = new Label(); 
18           Button b = new Button("OK"); 
19           b.addActionListener(this); 
20           Panel p = new Panel(); 
21           p.add(b); 
22           add("North", label); 
23           add("South", p); 
24       } 
25    
26       public void show(String message) { 
27           label.setText(message); 
28           setVisible(true); 
29       } 
30    
31       public void actionPerformed(ActionEvent e) { 
32           setVisible(false); 
33       } 
34   } 
35