编写了一个XEditorPane 类继承自JEditorPane
   
public class XEditorPane extends
        JEditorPane implements KeyListener {
.../*清空内容,显示文件*/
public void onViewFile(String sFilePath, String sFileName) {
clear();
        FileReader a = null;
        try {
            a = new FileReader(sFilePath);
            read(a, null);        } catch (FileNotFoundException e) {
        } catch (IOException e) {
        } finally {
            try {
                if (a != null) {
                    a.close();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            a = null;
        }
        installUndoRedo();
        setCursor(old);
    }    public void clear() {
        Document doc = getDocument();
        setVisible(false);
        try {
            doc.remove(0, doc.getLength());
        } catch (BadLocationException ex1) {
        }
        setVisible(true);
        repaint();
    }   在文件比较大的时候,比如1MB时,读入文件到显示的时候占用时间非常长,cpu也很高,请问各位大侠有没有什么好方法?