Hello; I’ve attempted to do my homework. I read
the article on centering boxes
, but this did not seem to help.
I’m attempting to put a LoginForm on the center of the screen.
My (layout) code (in my application’s init() method) looks like this:
final VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
this.mainWindow = new Window("My application", layout);
this.setMainWindow(this.mainWindow);
final LoginForm loginForm = new LoginForm();
loginForm.addListener(new LoginForm.LoginListener() {
// listener code omitted for brevity
});
loginForm.setHeight(400);
loginForm.setWidth(400);
layout.addComponent(loginForm);
layout.setComponentAlignment(loginForm, VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER, VerticalLayout.ALIGNMENT_VERTICAL_CENTER);
This results in a login form showing up in the upper left hand corner of the screen.
Thoughts?
My apologies if this is an obvious question; pointers to further (excellent) documentation welcomed.
Best,
Laird