Skip to content

Commit d51f5c2

Browse files
author
soheil_h_y
committed
1. Calling setText twice should not create two text nodes.
1 parent d1f5c79 commit d51f5c2

File tree

1 file changed

+9
-0
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+9
-0
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Label.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,15 @@ public void setText (String string) {
601601
textSizeCached = false;
602602
text = string;
603603
//handle.appendChild(document.createTextNode(text));
604+
/*
605+
* Calling setText twice should not make two text node for the handle.
606+
*/
607+
Element[] children = handle.childNodes;
608+
if(children != null){
609+
for(int i = 0; i < children.length; i++){
610+
handle.removeChild(children[i]);
611+
}
612+
}
604613
OS.insertText(handle, text);
605614
/*
606615
int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE), oldBits = newBits;

0 commit comments

Comments
 (0)