Here you can find the source of emptyDoc(JEditorPane pane)
Parameter | Description |
---|---|
pane | The JEditorPane from which to remove text. |
public static void emptyDoc(JEditorPane pane)
//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) { } } }