Darshan N Reddy
Darshan N Reddy

Reputation: 229

reuse a widget in GWT

I have a label widget and im trying to add this widget to the multiple cells in the flex table but the widget is appearing only in the first cell. Is it possible to reuse a widget in gwt?? how?

Label l1=new Label("USER") ;
tweetFlexTable.setWidget(0,0,l1);
tweetFlexTable.setWidget(0,1,l1);

Upvotes: 1

Views: 444

Answers (1)

Daniel Kurka
Daniel Kurka

Reputation: 7985

Every widget can only have one parent.

So you have to create as many widgets as you have cells, like this:

Label l1=new Label("USER") ;
tweetFlexTable.setWidget(0,0,l1);
Label l2=new Label("dunno") ;
tweetFlexTable.setWidget(0,1,l2);

Upvotes: 1

Related Questions