org.jgroups.demos.wb.MessageDialog Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.demos.wb;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MessageDialog extends Dialog implements ActionListener {
private final TextArea text=new TextArea("");
private final Font default_font=new Font("Helvetica",Font.PLAIN,12);
public MessageDialog(Frame parent, String sender, String msg) {
super(parent, "Msg from " + sender);
Button ok=new Button("OK");
setLayout(new BorderLayout());
setBackground(Color.white);
ok.setFont(default_font);
text.setFont(default_font);
text.setEditable(false);
text.setText(msg);
ok.addActionListener(this);
add("Center", text);
add("South", ok);
setSize(300, 150);
Point my_loc=parent.getLocation();
my_loc.x+=50;
my_loc.y+=150;
setLocation(my_loc);
Toolkit.getDefaultToolkit().beep();
show();
}
public void actionPerformed(ActionEvent e) {
dispose();
}
}