SmartGWT Dialog title not set correctly

2019-02-28 09:57发布

问题:

I have a custom dialog that extends the SmartGWT dialog. My problem is that the title and the close button of the dialog aren't displayed in the dialog's title but in the dialog's content under all other elements.

Here is a screeshot:

The bold test and the x button should be in the dialog's title.

My code basically is:

public class MyDialog extends Dialog {    

    public MyDialog() {       
        super();

        this.setTitle("test");

        this.setShowTitle(true);
        this.setShowCloseButton(true);
        this.setShowMaximizeButton(false);
        this.setShowMaximizeButton(false);
        this.setShowStatusBar(false);           
        this.setShowShadow(true);

        this.setWidth("500px");
        this.setHeight("300px");            
    }

    @Override
    protected void onInit() {

        Label lab =  new Label("test");
        this.addMember(lab);
    }
}

Is this a bug in SmartGWT or am I missing something? How can I place the title correctly?

Thanks for any help!

回答1:

There is a problem with your code. You've used

this.addMember(lab);

instead of

this.addItem(lab);