the pop up is a decorative pop up , the text in it is a label and close is a button. i have added the label and a button to horizontal panel and then added it to popup panel. i have tried with both invalidEntryVpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); invalidEntryVpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

but still not able to align it in center please help. thanks in advance

有帮助吗?

解决方案

Try like this

You have to add the widgets after you set the align center

VerticalPanel vpnPanel = new VerticalPanel();
        vpnPanel.add(scrollPanel);   //all controls added to scrill panel with help of set widget 
        vpnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        HorizontalPanel btnLayoutPanel = new HorizontalPanel();
        btnLayoutPanel.setSpacing(10);
        btnLayoutPanel.add(closeButton);
        vpnPanel.add(btnLayoutPanel);
        decPopuppanel.setWidget(vpnPanel);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top