Reputation: 886
I want to update a label after every 5s and it should be the only label in the RootLayoutPanel.Currently it adds a new label after every 5s but i want the same label to be updated.Can you suggest a method.Thanks
Upvotes: 0
Views: 147
Reputation: 46841
Use Timer to repeat after 5 sec.
Here is code:
import com.google.gwt.user.client.Timer;
final Label label=new Label("Hello ");
Timer timer=new Timer(){
@Override
public void run() {
label.setText("Hello "+Math.random()*100);
}
};
timer.scheduleRepeating(5000);
RootPanel.get().add(label);
Upvotes: 1