Wednesday, December 14, 2016

Re: How to make sure object is set before initWidget()


I have done like you said it. But I have another problem now.

As you can see the setUsername() method sets the username, and by using a simple alert I've checked and it's correct.

BUT that method does not get called before the constructor, that means that initWidget() gets called first, and I'm using the username there, and it will be null since the setUsername method does not get called before initWidget().

What can I do here in order to have my username set in the initWidget() method.?

public class UserPanel extends Composite implements UserView {

private MaterialContainer container;

private Presenter presenter;

private String username;


        public UserPanel() {
container = new MaterialContainer();

Widget mainMenu = createMenu();

public void setUsername(String username) {
this.username = username;

public void setPresenter(Presenter presenter) {
this.presenter = presenter;

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment