PDA

View Full Version : Problem with adding buttons in the center of horizontal panel



I_P
3 Oct 2011, 4:40 AM
Hello,
I have this code:

ContentPanel cp=new ContentPanel();
Button submitbutton = new Button("Submit");
submitbutton.disable();
Button closebutton = new Button("Close");

HorizontalPanel hp=new HorizontalPanel();
hp.setHorizontalAlign(HorizontalAlignment.CENTER);
hp.setBorders(false);
hp.add(submitbutton);
hp.add(closebutton);

cp.setBottomComponent(hp);
root.add(cp,cbld);
RootPanel.get().add(root);


root is Viewport and cbld is Central BorderLayoutData.
The problem is that HorizontalAlignment.CENTER doesn't work. I want to add my buttons in the centre of bottomcomponent, but they are still on the left. What do you think the problem is?