如何将Vaadin confirmdialog“确定”和“取消”按钮置于中间

如何将Vaadin confirmdialog“确定”和“取消”按钮置于中间,vaadin,Vaadin,我一直在使用从 是否可以将“确定”和“取消”按钮置于窗口中央?默认情况下,它位于窗口的右下角。在可用性方面,将按钮保持在右下角是一种很好的做法。请查看以了解更多详细信息。我建议不要牺牲个人习惯的行为规约。 只需在中间创建一个带有按钮的布局,并将其设置为确认对话框的内容。可以使用ConfirmDialog.get…Button()获取按钮。例如: ConfirmDialog cd = ConfirmDialog.getFactory().create("Title", "", "OK",

我一直在使用从


是否可以将“确定”和“取消”按钮置于窗口中央?默认情况下,它位于窗口的右下角。

在可用性方面,将按钮保持在右下角是一种很好的做法。请查看以了解更多详细信息。我建议不要牺牲个人习惯的行为规约。

只需在中间创建一个带有按钮的布局,并将其设置为确认对话框的内容。可以使用ConfirmDialog.get…Button()获取按钮。例如:

    ConfirmDialog cd = ConfirmDialog.getFactory().create("Title", "", "OK",
            "Cancel");
    cd.setHeight("400px");
    cd.setWidth("400px");
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(cd.getCancelButton());
    buttons.addComponent(cd.getOkButton());
    VerticalLayout content = new VerticalLayout(buttons);
    content.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
    content.setSizeFull();
    cd.setContent(content);
    cd.show(this, null, false);
然而,我同意简的观点,好的做法是把它们放在右下角