我希望 setHorizontalAlignment 将我的两个按钮从左侧移到中间。知道为什么这不起作用吗?所有相关代码都在下面并且非常简单。
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());
}
}