src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
Print this page
@@ -220,10 +220,16 @@
}
protected boolean setXAWTTextField(String txt) {
text = txt;
if (xtext != null) {
+ // Please note that we do not want to post an event
+ // if setText() replaces an empty text by an empty text,
+ // that is, if component's text remains unchanged.
+ if (xtext.getDocument().getLength() == 0 && txt.length() == 0) {
+ return true;
+ }
// JTextField.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
// the document listener has to be disabled while
// JTextField.setText() is called.
xtext.getDocument().removeDocumentListener(xtext);