RENDERING HTML WITH SWING A common need for Java developers, especially in the context of help systems, is to display rendered HTML within their Swing applications. Some programs simply use the installed browser on the user's system to display URLs in a separate window, but that approach can be clumsy and requires platform-specific code. Fortunately, Swing provides a simpler, integrated way to display and interact with basic HTML or RTF formats: the JEditorPane. To use JEditorPane as an HTML-rendering component, you'll need to: * Set the editable property to false. * Create and register a HyperlinkListener object if you want links to be active. * Provide the URL or HTML text to render using one of the setPage() methods or in the constructor. Here's a simple HTML renderer window that just displays a single URL and leaves exception and hyperlink handling as an exercise for the reader (you'll need to be online for the URL to work): import javax.swing.*; import java.net.*; public class HTMLViewer { public static void main(String[] args) throws Exception { JFrame viewer = new JFrame(); JEditorPane htmlview = new JEditorPane(); htmlview.setEditable(false); JScrollPane scroller = new JScrollPane(htmlview); viewer.getContentPane().add(scroller); viewer.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); viewer.setSize(400,400); htmlview.setPage( new URL("http://java.sun.com/j2se/1.3.0/docs/api/javax/swing/JEditorPane.html")); viewer.setVisible(true); } } There are some limitations to JEditorPane: it doesn't understand style sheets; it doesn't have JavaScript; it doesn't handle many non-English languages very well, if at all; and it's fairly brain-dead about complex or nonconformant HTML tags. You're not going to build a complete browser out of JEditorPane, but you can display straightforward, hyperlinked information with tables and images, and that's all that's needed for many applications. You can also do quite a lot to customize JEditorPane's behavior, so be sure to read the API description thoroughly to explore the available options. HTML files can be a simple way to present formatted, hyperlinked documentation systems. The JEditorPane class provides a simple, effective method to present and manage that content for both online and offline environments.