JFormattedTextField and DocumentEvent

Is it possible to have a JFormattedTextField that only fires DocumentEvents if the text (or the value) changes?

I have a field for example:

JFormattedTextField idField =new JFormattedTextField();

NumberFormat form1 = NumberFormat.getInstance();

form1.setMinimumFractionDigits(0);

form1.setMaximumFractionDigits(0);

idField =new JFormattedTextField(form1);

idField.setColumns(10);

There a DocumentEvent (which i use to detect changes allover the form) is fired when this field gets focus (before any chance to alter something) and a DocumentEvent is fired when this field loose focus even when nothing is changed.

Is it possible to suppress this DocumentEvents which do not result from changing the value or the text of the field?

thanks

[871 byte] By [oegerharda] at [2007-11-26 14:18:13]
# 1
How about simply not processing those events in the event handler methods? O_o Or at least asking in the Swing forum?I guess you could only suppress those events (if at all) by creating a custom subclass and overriding that behavior.
CeciNEstPasUnProgrammeura at 2007-7-8 2:08:56 > top of Java-index,Java Essentials,Java Programming...
# 2
> Or at least asking in the Swing forum?Oh I see I was too hasty in choosing this forum. Yes, I will ask therethanks anyway.
oegerharda at 2007-7-8 2:08:56 > top of Java-index,Java Essentials,Java Programming...
# 3

> How about simply not processing those events in the

> event handler methods? O_o Or at least asking in the

> Swing forum?

I second both statements.

You actually do not want to suppress the events, but ignore them. So, make the receiver handle relevant events only and don't "shoot" the messenger for sending them.

stefan.schulza at 2007-7-8 2:08:56 > top of Java-index,Java Essentials,Java Programming...
# 4
Reposted here: http://forum.java.sun.com/thread.jspa?threadID=5121907&tstart=0
camickra at 2007-7-8 2:08:56 > top of Java-index,Java Essentials,Java Programming...