Hello all, i`m hust trying to make panel component display in the center of web page, but panel displayed in the left top corner of window. How can i decide it? Thanks a lot
GridLayout gl = new GridLayout();
Panel aPanel = new Panel("Hello world");
HorizontalLayout hl = new HorizontalLayout();
aPanel.setContent(hl);
hl.addComponents(new TextField("Login"), new TextField("Password"), new Button("Register"));
gl.addComponent(aPanel);
gl.setComponentAlignment(aPanel, Alignment.MIDDLE_CENTER);
setContent(gl)
Something like this does the trick:
VerticalLayout root = new VerticalLayout():
root.setSizeFull();
root.addComponent(yourPanel);
root.setComponentAlignment(yourPanel, Alignment.MIDDLE_CENTER);