/Users/lyon/j4p/src/ip/hak/ErrorDialog.java
|
1 package ip.hak;
2
3 import java.awt.*;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6
7
8 public class ErrorDialog extends ClosableDialog implements ActionListener {
9 Button okButton;
10 String m = null;
11 Label lb;
12
13 public ErrorDialog(Frame parent, String titile, String mes) {
14 super(parent, titile, true);
15 m = mes;
16 init();
17 setVisible(true);
18 }
19
20 public void init() {
21 setLayout(null);
22 int l = m.length();
23 int w = l * 6 + 20;
24 setSize(w, 100);
25 lb = new Label(m);
26 lb.setSize(l * 6, 20);
27 lb.setLocation(10, 35);
28 add(lb);
29
30 okButton = new Button("OK");
31 okButton.setSize(40, 20);
32 okButton.setLocation((w - 40) / 2, 70);
33 add(okButton);
34 okButton.addActionListener(this);
35 }
36
37 public void actionPerformed(ActionEvent e) {
38 if (e.getSource() == okButton)
39 dispose();
40 }
41 }
42