JTextField 侦听文本改变时间,出现:java.lang.IllegalStateException: Attempt to mutate in notification异常,帮帮我,急死了!
a=new JTextField();下面是它的侦听事件
a.getDocument()事件
public void insertUpdate(DocumentEvent e)
{
if(e.getDocument()==a.getDocument())
{
if(a.getText().length()==3)
{a.setText("ddd");}
else
tf.setText("null");
}
}
却出现java.lang.IllegalStateException: Attempt to mutate in notification
错误,请问问什么?
我就是想使得JTextField像TextField一样能够侦听文本的改变,为什么出现了这种异常?请问如何处理?谢谢!