HtmlDemo Constructor
// Set the title for this demo, and an icon used to represent this
// demo inside the SwingSet2 app.
super(swingset, "HtmlDemo", "toolbar/JEditorPane.gif");
try {
URL url = null;
// System.getProperty("user.dir") +
// System.getProperty("file.separator");
String path = null;
try {
path = "/resources/index.html";
url = getClass().getResource(path);
} catch (Exception e) {
System.err.println("Failed to open " + path);
url = null;
}
if(url != null) {
html = new JEditorPane(url);
html.setEditable(false);
html.addHyperlinkListener(createHyperLinkListener());
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(html);
getDemoPanel().add(scroller, BorderLayout.CENTER);
}
} catch (MalformedURLException e) {
System.out.println("Malformed URL: " + e);
} catch (IOException e) {
System.out.println("IOException: " + e);
}