I would expect setHorizontalAlignment to move my two buttons from the left over to the middle. Any idea why this is not working? All of the relevant code is below and pretty straightforward.

public void onClick(ClickEvent event) {
final DialogBox deleteDialog = new DialogBox();
deleteDialog.setModal(false);
deleteDialog.setGlassEnabled(true);
HorizontalPanel buttonPane = new HorizontalPanel();
buttonPane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
buttonPane.add(deleteDialogOKButton);
buttonPane.add(deleteDialogCancelButton);
deleteDialog.center();
deleteDialog.add(buttonPane);
deleteDialog.setText("Delete this Station?");
deleteDialogOKButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
stationService.deleteStation(station, new DeleteStationCallback());
deleteDialog.hide();
}});
deleteDialogCancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
deleteDialog.hide();
}});
deleteDialog.show();
//stationService.deleteStation(station, new DeleteStationCallback());
}
}
When you don’t give any width to your horizontal panel, it takes up the sum of the width of its contents. So
HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_LEFTor any other alignment doesnot matter as its fitted in the given area. Try setting up the following,If this also doesn’t work then you have to set cell alignment using the API