Java JEditorPane emptyDoc(JEditorPane pane)

Here you can find the source of emptyDoc(JEditorPane pane)

Description

Empties the text contents of a given JEditorPane .

License

Open Source License

Parameter

Parameter Description
pane The JEditorPane from which to remove text.

Declaration

public static void emptyDoc(JEditorPane pane) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JEditorPane;

import javax.swing.text.BadLocationException;
import javax.swing.text.Document;

public class Main {
    /**//from w w  w  . j  a v a2  s.com
     * Empties the text contents of a given {@code JEditorPane}.
     *
     * @param pane The {@code JEditorPane} from which to remove text.
     */
    public static void emptyDoc(JEditorPane pane) {
        Document doc = pane.getDocument();
        try {
            doc.remove(0, doc.getLength());
        } catch (BadLocationException e) {
        }
    }
}

Related

  1. addEditorPaneToOther(JEditorPane[] old, JEditorPane add)
  2. addHyperLinkListener(JEditorPane editorPane)
  3. decorateStyleSheet(JEditorPane editor)
  4. displayEditorPaneWithNoBorderAndTranslucent(JEditorPane editorPane)
  5. enforceJEditorPaneFont(JEditorPane jEditorPane, Font font)
  6. formatEditorPaneAsLabel(JEditorPane editor)
  7. getEditor(JEditorPane editor, String html, int width, Color transparentColor, Font font)
  8. getImage(JEditorPane editor, Color transparentColor)