@@ -70,14 +70,12 @@ public class Button extends Component
7070 // bindings of the button separatly from its icon. All `HasText` methods
7171 // delegate to this node.
7272 private final Text textNode = new Text ("" );
73- {
74- add (textNode );
75- }
7673
7774 /**
7875 * Default constructor. Creates an empty button.
7976 */
8077 public Button () {
78+ add (textNode );
8179 }
8280
8381 /**
@@ -88,6 +86,7 @@ public Button() {
8886 * @see #setText(String)
8987 */
9088 public Button (String text ) {
89+ this ();
9190 setText (text );
9291 }
9392
@@ -98,6 +97,7 @@ public Button(String text) {
9897 * the signal of text value
9998 */
10099 public Button (Signal <String > textSignal ) {
100+ this ();
101101 bindText (textSignal );
102102 }
103103
@@ -109,6 +109,7 @@ public Button(Signal<String> textSignal) {
109109 * @see #setIcon(Component)
110110 */
111111 public Button (Component icon ) {
112+ this ();
112113 setIcon (icon );
113114 }
114115
@@ -126,6 +127,7 @@ public Button(Component icon) {
126127 * @see #setIcon(Component)
127128 */
128129 public Button (String text , Component icon ) {
130+ this ();
129131 setIcon (icon );
130132 setText (text );
131133 }
@@ -139,6 +141,7 @@ public Button(String text, Component icon) {
139141 * the icon inside the button
140142 */
141143 public Button (Signal <String > textSignal , Component icon ) {
144+ this ();
142145 setIcon (icon );
143146 bindText (textSignal );
144147 }
@@ -155,6 +158,7 @@ public Button(Signal<String> textSignal, Component icon) {
155158 */
156159 public Button (String text ,
157160 ComponentEventListener <ClickEvent <Button >> clickListener ) {
161+ this ();
158162 setText (text );
159163 addClickListener (clickListener );
160164 }
@@ -170,6 +174,7 @@ public Button(String text,
170174 */
171175 public Button (Signal <String > textSignal ,
172176 ComponentEventListener <ClickEvent <Button >> clickListener ) {
177+ this ();
173178 bindText (textSignal );
174179 addClickListener (clickListener );
175180 }
@@ -186,6 +191,7 @@ public Button(Signal<String> textSignal,
186191 */
187192 public Button (Component icon ,
188193 ComponentEventListener <ClickEvent <Button >> clickListener ) {
194+ this ();
189195 setIcon (icon );
190196 addClickListener (clickListener );
191197 }
@@ -205,6 +211,7 @@ public Button(Component icon,
205211 */
206212 public Button (String text , Component icon ,
207213 ComponentEventListener <ClickEvent <Button >> clickListener ) {
214+ this ();
208215 setIcon (icon );
209216 setText (text );
210217 addClickListener (clickListener );
@@ -223,6 +230,7 @@ public Button(String text, Component icon,
223230 */
224231 public Button (Signal <String > textSignal , Component icon ,
225232 ComponentEventListener <ClickEvent <Button >> clickListener ) {
233+ this ();
226234 setIcon (icon );
227235 bindText (textSignal );
228236 addClickListener (clickListener );
0 commit comments