Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
cannot resize main window
Hello,
This might be a newbie issue, because I just started using vaadin.
The thing that I want to achieve is that the main window is not the entire browsersize (when the browser is maximized), but instead, I want the main window to be centered in the browser, with a specific size, lets say 600x800.
What I have done till now is:
private void buildMainLayout() {
setMainWindow(new Window("Chargebox CIMS Applications"));
VerticalSplitPanel mainVerticalSplitPanel = new VerticalSplitPanel();
Label titleLabel = getTitleLabel();
HorizontalSplitPanel mainHorizontalSplitPanel = getMainHorizontalSplitPanel();
mainVerticalSplitPanel.setSplitPosition(45, Sizeable.UNITS_PIXELS);
mainVerticalSplitPanel.setLocked(true);
// mainVerticalSplitPanel.setHeight("450px");
mainVerticalSplitPanel.setWidth("100%");
mainVerticalSplitPanel.addComponent(titleLabel);
mainVerticalSplitPanel.addComponent(mainHorizontalSplitPanel);
[color=#f60c0c]getMainWindow().setContent(mainVerticalSplitPanel);
getMainWindow().setHeight("600px");
getMainWindow().setWidth("800px");
getMainWindow().center();[/color]
}
Why is this not working?
Last updated on
I've found the solution, which is actually quite simple. Or you can work with a gridlayout or I did it like this:
VerticalLayout mainVerticalLayout = (VerticalLayout) getMainWindow().getContent();
mainVerticalLayout.setSizeFull();
Panel mainVerticalPanel = new Panel();
mainVerticalPanel.setCaption("Chargebox CIMS");
mainVerticalPanel.setHeight("500px");
mainVerticalPanel.setWidth("1200px");
mainVerticalLayout.addComponent(mainVerticalPanel);
mainVerticalLayout.setComponentAlignment(mainVerticalPanel, Alignment.MIDDLE_CENTER);
Last updated on
You cannot reply to this thread.