List of usage examples for javax.swing.text.html HTMLDocument setTokenThreshold
public void setTokenThreshold(int n)
From source file:ReplaceReader.java
public static void main(String[] args) { try {/* www.j a v a2s. c o m*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new JFrame("JEditorPane with Custom Reader"); JEditorPane ep = new JEditorPane(); f.getContentPane().add(new JScrollPane(ep)); f.setSize(400, 300); f.setVisible(true); HTMLEditorKit kit = new HTMLEditorKit() { public Document createDefaultDocument() { HTMLDocument doc = new CustomHTMLDocument(getStyleSheet()); doc.setAsynchronousLoadPriority(4); doc.setTokenThreshold(100); return doc; } }; ep.setEditorKit(kit); try { Document doc = ep.getDocument(); doc.putProperty("IgnoreCharsetDirective", new Boolean(true)); kit.read(new FileReader(args[0]), doc, 0); } catch (Exception e) { System.out.println("Exception while reading HTML " + e); } }