src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
Print this page
*** 124,133 ****
--- 124,139 ----
}
@Override
public void setText(final String l) {
synchronized (getDelegateLock()) {
+ // Please note that we do not want to post an event
+ // if TextArea.setText() or TextField.setText() replaces an empty text by an empty text,
+ // that is, if component's text remains unchanged.
+ if (l.isEmpty() && getTextComponent().getDocument().getLength() == 0) {
+ return;
+ }
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
// the document listener has to be disabled while
// JTextArea.setText() is called.
final Document document = getTextComponent().getDocument();