new JEditorPane('text/html', 'html string') : JEditorPane « javax.swing « Java by API






new JEditorPane('text/html', 'html string')

 
import java.awt.BorderLayout;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class MainClass {
  public static void main(String args[]) {
    JFrame f = new JFrame("JEditorPane Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JEditorPane editor = new JEditorPane(
        "text/html",
        "<H3>Help</H3><center>www.java2s.com</center><li>One<li><i>Two</i><li><u>Three</u>");
    editor.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(editor);
    f.add(scrollPane, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);
  }
}

           
         
  








Related examples in the same category

1.new JEditorPane(String URL) ('http://www.java2s.com')
2.JEditorPane: addHyperlinkListener(HyperlinkListener listener)
3.JEditorPane: getDocument()
4.JEditorPane: setDocument(Document doc)
5.JEditorPane: setEditable(boolean b)
6.JEditorPane: setPage(URL url)