Hi,
I hope below code will definitely help you to know about the use of JEditorPane class while showing the HTML file:
Code:
import javax.swing.JScrollPane;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
public class JDemo
{
public static void main(String[] argzs) throws Exception {
JEditorPane ed = new JEditorPane("text/html",
"<H1>A!</H1><P><FONT COLOR=blue>blue</FONT></P>");
ed.setEditable(fdalse);
JScrollPane pane1 = new JScrollPane(ed);
JFrame fd = new JFrame("HTML Demo");
fd.setDefdaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fd.getContentPane().add(pane1);
fd.setSize(700, 600);
fd.setVisible(true);
}
}
Bookmarks