import java.awt.*;
import java.awt.event.*;

class CopyMe extends Dialog implements ActionListener
{
	boolean id = false;
  	Button ok,can;

  	CopyMe(Frame frame, String msg, boolean okcan)
  	{
		super(frame, "email address", true);

 		WindowListener wl = new WindowAdapter()
   		{
	   		public void windowClosing(WindowEvent e)
	   		{
		   		setVisible(false);
		   		System.exit(0);
	   		}
   		};

		setLayout(new BorderLayout());
		addWindowListener(wl);
		add("North", new Label("highlight & ctrl-C to copy"));
		add("Center", new TextField(msg));
		addOKCancelPanel(okcan);
		createFrame();
		pack();
		setVisible(true);
	}

	void addOKCancelPanel( boolean okcan )
	{
		Panel p = new Panel();
		p.setLayout(new FlowLayout());
		createOKButton( p );
		add("South",p);
	}

	void createOKButton(Panel p)
	{
		p.add(ok = new Button("CLOSE"));
		ok.addActionListener(this);
	}

	void createFrame()
	{
		Dimension d = getToolkit().getScreenSize();
		setLocation(d.width/3,d.height/3);
	}

	public void actionPerformed(ActionEvent ae)
	{
		if(ae.getSource() == ok)
		{
			id = true;
			setVisible(false);
		}
		else if(ae.getSource() == can)
		{
			setVisible(false);
		}
	}
}