package ip.hak;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class ErrorDialog extends ClosableDialog implements ActionListener {
  Button okButton;
  String m = null;
  Label lb;

  public ErrorDialog(Frame parent, String titile, String mes) {
    super(parent, titile, true);
    m = mes;
    init();
    setVisible(true);
  }

  public void init() {
    setLayout(null);
    int l = m.length();
    int w = l * 6 + 20;
    setSize(w, 100);
    lb = new Label(m);
    lb.setSize(l * 6, 20);
    lb.setLocation(10, 35);
    add(lb);

    okButton = new Button("OK");
    okButton.setSize(40, 20);
    okButton.setLocation((w - 40) / 2, 70);
    add(okButton);
    okButton.addActionListener(this);
  }

  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == okButton)
      dispose();
  }
}