如何放置Vaadin confirmdialog确定,在中心取消按钮(How to place Va

2019-10-18 20:10发布

我一直在使用ConfirmDialog 附加从Vaadin 目录 。

是否有可能把确定取消按钮在窗口的中心? 默认情况下,它是在窗口的右上角。

Answer 1:

只要创建在中间的按钮布局,并将其设置为ConfirmDialog的内容。 您可以使用ConfirmDialog.get ...按钮获取按钮()。 例:

    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);

但是我一月同意,比较好的做法是让他们在右下角。



Answer 2:

保持按钮右下角是很好的做法,当谈到可用性。 看看http://uxmovement.com/buttons/why-ok-buttons-in-dialog-boxes-work-best-on-the-right/了解更多详情。 我会建议不以牺牲行为约定的个人品味。



文章来源: How to place Vaadin confirmdialog ok and cancel button in center
标签: vaadin