I have a horizontal panel and 2, sometimes 3 buttons.
Button btn1 = new Button("Ok");
Button btn2 = new Button("Cancel");
HorizontalPanel panel = new HorizontalPanel();
panel.setWidth(100%);
panel.add(btn1);
panel.add(btn2);
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
But only cancel button is in the center then. But how to align both…or even any number of buttons to the center on one horizontal panel?
You can place those buttons in a smaller panel, add that panel to the larger panel, and then align the smaller panel: