/Users/lyon/j4p/src/ip/hak/MessageDialog.java

1    package ip.hak; 
2     
3    import java.awt.*; 
4    import java.awt.event.ActionEvent; 
5    import java.awt.event.ActionListener; 
6     
7    public class MessageDialog extends ClosableDialog implements ActionListener { 
8        Label messageLabel; 
9        Button okButton; 
10    
11    
12       public MessageDialog(Frame f, String name, boolean md, String message, int w, int h) { 
13           super(f, name, md); 
14           setLayout(new GridLayout(2, 1, 15, 15)); 
15    
16           messageLabel = new Label(message); 
17           messageLabel.setAlignment(messageLabel.CENTER); 
18           add(messageLabel); 
19    
20           okButton = new Button("OK"); 
21           add(okButton); 
22           okButton.addActionListener(this); 
23    
24           setSize(w, h); 
25           show(); 
26       } 
27    
28       public void actionPerformed(ActionEvent e) { 
29           if (e.getSource() == okButton) { 
30               dispose(); 
31               return; 
32           } 
33       } 
34   } 
35