// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.awt.BorderLayout;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class ShowHtml extends JFrame {
    private static String load(InputStream is) throws IOException {
        StringBuffer sb = new StringBuffer("");
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        String line;
        while((line = in.readLine()) != null) {
            sb.append(line);
            sb.append(' ');
        }
        return sb.toString();
    }
    private JEditorPane html;
    public ShowHtml() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BorderLayout());
        html = new JEditorPane();
        html.setContentType("text/html");
        try {
            html.setText(load(getClass().getResourceAsStream("/september/text.html")));
        } catch(IOException ex) {
            html.setText("**** Can not find HTML resource ****");
        }
        getContentPane().add(html, BorderLayout.CENTER);
        pack();
    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame f = new ShowHtml();
                f.setVisible(true);
            }
        });
    }
}
