弹出窗口如何居中显示

Window mywindow = new Window();
UI.getCurrent().addWindow(mywindow);
mywindow.setResizable(false);
mywindow.setHeight(“300px”);
mywindow.setWidth(“400px”);
mywindow.setPositionX(300);
mywindow.setPositionY(100);
弹出窗口如何居中显示,不是通过指定坐标

mywindow.center()