
import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;
import javax.swing.*;
import javax.swing.event.*;

public class HelpWin extends JFrame
{
	public HelpWin()
	{
		super(CDcreator.i18n("titleHelpWin"));
		setBounds(200, 200, 600, 400);
		setContentPane(new HtmlPane());
	}
}

class HtmlPane extends JScrollPane implements HyperlinkListener
{
	JEditorPane html;

	public HtmlPane()
	{
		try {
/*			File f = new SecFile("doc/index.html");
			String s = f.getAbsolutePath();
			s = "file:" + s;
			URL url = new URL(s);
*/			URL url = ClassLoader.getSystemResource(
				"doc/index.html");

			html = new JEditorPane(url);
			html.setEditable(false);
			html.addHyperlinkListener(this);

			JViewport vp = getViewport();
			vp.add(html);
		}
		catch (MalformedURLException e) {
			System.out.println("Malformed URL: " + e);
		}
		catch (IOException e) {
			System.out.println("IOException: " + e);
		}
	}

	/**
	 *
	 */
	public void hyperlinkUpdate(HyperlinkEvent e)
	{
		if (e.getEventType()
			== HyperlinkEvent.EventType.ACTIVATED)
		{
			try {
				html.setPage(e.getURL());
			}
			catch (IOException e2) {
				System.out.println("IOException: " + e2);
			}
		}
	}
}
