Hello,
I’m looking to adapt the size of a SplitPanel to the content of my browser window. However if I do this kind of code, the screen is black which is not the case if I use sizes in px units. Do you know how to do what I’m trying to do ?
Not working with % units :
public void init() {
Window mainWindow = new Window("Vaadintest Application");
Label label = new Label("Hello Vaadin user");
// Have a vertical SplitPanel as the main component.
SplitPanel vertical = new SplitPanel();
// Set the size of the SplitPanel rather than the containing Panel,
// because then we know how much space we have for the panels.
vertical.setHeight("100%");
vertical.setWidth("100%");
// Set the split position to 50 pixels, which is more than
// enough height for the Label in the upper panel.
vertical.setSplitPosition(50, SplitPanel.UNITS_PIXELS);
vertical.addComponent(new Label("The contents of the upper area."));
vertical.addComponent(new Label("The contents of the down area."));
// Put a horizontal SplitPanel in the lower area.
mainWindow.addComponent(vertical);
setMainWindow(mainWindow);
}
Working with px units :
Window mainWindow = new Window("Vaadintest Application");
Label label = new Label("Hello Vaadin user");
// Have a vertical SplitPanel as the main component.
SplitPanel vertical = new SplitPanel();
// Set the size of the SplitPanel rather than the containing Panel,
// because then we know how much space we have for the panels.
vertical.setHeight("500px");
vertical.setWidth("500px");
// Set the split position to 50 pixels, which is more than
// enough height for the Label in the upper panel.
vertical.setSplitPosition(50, SplitPanel.UNITS_PIXELS);
vertical.addComponent(new Label("The contents of the upper area."));
vertical.addComponent(new Label("The contents of the down area."));
// Put a horizontal SplitPanel in the lower area.
mainWindow.addComponent(vertical);
setMainWindow(mainWindow);
Regards,
Denis.