JEditorPane: setEditable(boolean b) : JEditorPane « javax.swing « Java by API






JEditorPane: setEditable(boolean b)

  
import java.awt.BorderLayout;
import java.awt.Container;

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

public class Main {
  public static void main(String args[]) {
    JFrame f = new JFrame("JEditorPane Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = f.getContentPane();
    JEditorPane editor = new JEditorPane(
        "text/html",
        "<H3>Help</H3><center><IMG src=file:///c:/a.jpg></center><li>One<li><i>Two</i><li><u>Three</u>");
    editor.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(editor);
    content.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.new JEditorPane('text/html', 'html string')
3.JEditorPane: addHyperlinkListener(HyperlinkListener listener)
4.JEditorPane: getDocument()
5.JEditorPane: setDocument(Document doc)
6.JEditorPane: setPage(URL url)