package gve.calc;

//import awt.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;

public class LicenseWindow extends Frame implements WindowListener {
	private TextArea text;

	public LicenseWindow() {
		super("GveCalc "+Main.versionString+" license");
		text = new TextArea();
		add("Center",text);
		try {
			InputStream stream = getClass().getResourceAsStream("GPL.text");
			if (stream == null) {
				// Maybe I'm applet, try to read as url
				// PENDING
			}
			if (stream != null) {
				StringBuffer license = new StringBuffer(19000);
				while (true) {
					int c = stream.read();
					if (c < 0) break;
					if (c == 9) license.append("        ");
					else if (c == 12) continue;	// pgbreak
					else license.append((char)c);
				}
				stream.close();
				text.append(license.toString());
			}
		} catch(IOException exc) {}
		setSize(300,300);
		text.setEditable(false);
		addWindowListener(this);
		show();
	}

	public void windowActivated(WindowEvent e) {}
	public void windowClosed(WindowEvent e) {}
	public void windowClosing(WindowEvent e) { dispose(); }
	public void windowDeactivated(WindowEvent e) {}
	public void windowDeiconified(WindowEvent e) {}
	public void windowIconified(WindowEvent e) {}
	public void windowOpened(WindowEvent e) {}	
}