Java examples for Swing:JEditorPane
Displaying Simple HTML Files
import java.awt.BorderLayout; import java.io.IOException; import javax.swing.JEditorPane; import javax.swing.JFrame; public class Main { public static void m() { try {/*w w w . j a v a2s . c o m*/ String url = "http://java.sun.com"; JEditorPane editorPane = new JEditorPane(url); editorPane.setEditable(false); JFrame frame = new JFrame(); frame.getContentPane().add(editorPane, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); } catch (IOException e) { } } }