java.lang.IllegalStateException, während mit Dokument Hörer in TextArea, Java

DocumentListener dl = new MessageDocumentListener();
((AbstractDocument) nboxArea.getDocument()).setDocumentFilter(new DocumentFilter() {
    public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
        string = string.replaceAll("\t", "");
        super.insertString(fb, offset, string,(javax.swing.text.AttributeSet) attr);
    }

    public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
        text = text.replaceAll("\t", "");
        //TODO must do something here
        super.replace(fb, offset, length, text,(javax.swing.text.AttributeSet) attrs);
    }
});

JTextArea evArea = (JTextArea) c;
evArea.getDocument().removeDocumentListener(dl);
evArea.setText(originalMessage);

In diesem Fall fand ich die folgende Fehlermeldung während der text in der textarea. Ich weiß nicht, wie zu lösen sind.

Exception in thread "AWT-EventQueue-0" 
java.lang.IllegalStateException: Attempt to mutate in notification

Ich denke, das problem ist das festlegen der text im Dokument oder die Einstellung Dokument im Dokument Hörer. Aber ich weiß nicht, wie man dieses Problem lösen. Bitte helfen Sie mir, dieses Problem zu lösen.

Schreibe einen Kommentar