01: /*
02: * AlertFrame.java
03: *
04: * Created on April 10, 2002, 12:11 PM
05: */
06: package tools.tracesviewer;
07:
08: import javax.swing.*;
09:
10: /**
11: *
12: *@version 1.2
13: *
14: *@author Olivier Deruelle <br/>
15: *
16: *
17: *
18: */
19: public class AlertFrame extends JOptionPane {
20:
21: public String finalInputValue;
22:
23: /** Creates new AlertFrame */
24: public AlertFrame(String text, int messageType) {
25: super ("Alert");
26: if (messageType == JOptionPane.ERROR_MESSAGE)
27: showMessageDialog(this , text, "Error", messageType);
28: else if (messageType == JOptionPane.WARNING_MESSAGE)
29: showMessageDialog(this , text, "Warning", messageType);
30: else
31: showMessageDialog(this , "Unknown alert message");
32:
33: }
34:
35: /** Creates new AlertFrame */
36: public AlertFrame(String text, int messageType,
37: String initialInputValue) {
38: super ("Alert");
39: finalInputValue = null;
40: if (messageType == JOptionPane.ERROR_MESSAGE)
41: showMessageDialog(this , text, "Error", messageType);
42: else if (messageType == JOptionPane.WARNING_MESSAGE)
43: showMessageDialog(this , text, "Warning", messageType);
44: else if (messageType == JOptionPane.INFORMATION_MESSAGE) {
45: finalInputValue = (String) showInputDialog(this , text,
46: "Information", messageType, null, null,
47: initialInputValue);
48: } else
49: showMessageDialog(this , "Unknown alert message");
50:
51: }
52:
53: /** Creates new AlertFrame */
54: public AlertFrame(String text) {
55: super ("Alert");
56: // information message by default
57: showMessageDialog(this, text);
58: }
59:
60: }
|