Form Buttons

Hi,
How can align the buttons in a form?

I’m trying with this code… but the buttons are aligned at left:

		
private class FormWindow extends Form{
.......
........
........

	                HorizontalLayout hl=(HorizontalLayout) getFooter();
			hl.setSpacing(true);
			hl.addComponent(okButton);
			hl.addComponent(cancelButton);
			hl.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);
			hl.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

Thanks!!!

I believe the buttons are correctly aligned within the footer, but the footer has undefined width and is on the left side.

If you cannot align the whole footer on the right (not sure), try e.g. hl.setWidth(“100%”) and (if necessary) add an empty spacer with expand ratio 1.0f as the first component.