我有两个类
public class ABC {
    ...
    final StyledDocument doc = new DefaultStyledDocument();
    final JTextPane textPane = new JTextPane(doc);
    DocumentListenerForABC ear = new DocumentListenerForABC();
    doc.addDocumentListener(ear);
    ...
}public class DocumentListenerForABC implements DocumentListener {
    ...
    public void insertUpdate(DocumentEvent arg0) {
Document eventDoc = arg0.getDocument(); 
int offset = arg0.getOffset();
int length = arg0.getLength();
try {
         String input = eventDoc.getText(offset, length);
System.out.println(input);                          //这里有输出
} catch (BadLocationException ble){}
    }
    ...
}我输入abc的时候,我期待的输出是
a
ab
abc
而事实上输出是
a
b
c
因为每次的length都是1,而不是整个document的length,怎样修改?谢谢