01: // $Id: MessageDialog.java,v 1.2 2004/09/23 16:29:34 belaban Exp $
02:
03: package org.jgroups.demos.wb;
04:
05: import java.awt.*;
06: import java.awt.event.ActionEvent;
07: import java.awt.event.ActionListener;
08:
09: public class MessageDialog extends Dialog implements ActionListener {
10: private final TextArea text = new TextArea("");
11: private final Font default_font = new Font("Helvetica", Font.PLAIN,
12: 12);
13:
14: public MessageDialog(Frame parent, String sender, String msg) {
15: super (parent, "Msg from " + sender);
16:
17: Button ok = new Button("OK");
18:
19: setLayout(new BorderLayout());
20: setBackground(Color.white);
21:
22: ok.setFont(default_font);
23: text.setFont(default_font);
24: text.setEditable(false);
25: text.setText(msg);
26:
27: ok.addActionListener(this );
28:
29: add("Center", text);
30: add("South", ok);
31:
32: setSize(300, 150);
33:
34: Point my_loc = parent.getLocation();
35: my_loc.x += 50;
36: my_loc.y += 150;
37: setLocation(my_loc);
38: Toolkit.getDefaultToolkit().beep();
39: show();
40: }
41:
42: public void actionPerformed(ActionEvent e) {
43: dispose();
44: }
45:
46: }
|