package hexenschach.gui.help;
import java.awt.Color;
import java.awt.Dimension;
import java.net.MalformedURLException;
import java.net.URL;
import hexenschach.gui.help.html.Loader;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
public class HelpWindow {
public static void main(String[] args) {
HelpWindow wnd = new HelpWindow();
wnd.show();
}
private JFrame frame = new JFrame("Hexenschach Hilfe");
private JEditorPane editor = new JEditorPane();
private HTMLDocument doc;
public HelpWindow() {
editor.setEditorKit(new HTMLEditorKit());
editor.setEditable(false);
String str = Loader.getIndexText();
editor.setText(str);
doc = (HTMLDocument) editor.getDocument();
try {
doc.setBase(new URL(Loader.getBaseUrl()));
} catch (MalformedURLException e) {
e.printStackTrace();
}
JScrollPane editorScrollPane = new JScrollPane(editor);
editorScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
editorScrollPane.setPreferredSize(new Dimension(250, 145));
editorScrollPane.setMinimumSize(new Dimension(10, 10));
editor.setBackground(new Color(231, 178, 71));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().add(editorScrollPane);
frame.pack();
frame.setSize(800, 600);
}
public void show() {
frame.setVisible(true);
}
}