/Users/lyon/j4p/src/ip/gui/dialog/MessLog.java
|
1 package ip.gui.dialog;
2
3 import java.awt.*;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6
7 /**
8 MessLog - the message dialog
9 */
10 public class MessLog extends Dialog implements ActionListener {
11 private static boolean modal = true;
12 private boolean done = false;
13 public Button yesButton = new Button("OK");
14 public boolean ok = false;
15
16
17 private Label label;
18 private Panel buttonPanel = new Panel();
19
20 public static void main(String args[]) {
21 MessLog bl = new MessLog(
22 new Frame(),
23 "MessLog!",
24 "An informational message...");
25 }
26
27 public static void error(Object s) {
28 new MessLog(
29 new Frame(),
30 "Kahindu System Error!",
31 s.toString());
32 }
33
34 public MessLog(Frame frame, String title, String prompt) {
35 super(frame, title, modal);
36 label = new Label(prompt);
37 buttonPanel.setLayout(
38 new FlowLayout(FlowLayout.RIGHT));
39 buttonPanel.add(label);
40 buttonPanel.add(yesButton);
41 yesButton.addActionListener(this);
42 add("South", buttonPanel);
43 pack();
44 show();
45
46 }
47
48 public void actionPerformed(ActionEvent e) {
49 if (e.getSource() == yesButton) ok = true;
50
51 done = true;
52 setVisible(false);
53 return;
54 }
55
56
57 }
58