请注意我正在使用Vaadin。
我正在努力让中间面板扩展以填充大部分屏幕,顶部和底部分别有页眉和页脚。这是我的代码:
public class GridpocApplication extends Application {
@Override
public void init() {
System.out.println("starting now.");
final Window mainWindow = new Window("My Application");
setMainWindow(mainWindow);
mainWindow.getContent().setSizeFull();
VerticalLayout mainColumn = new VerticalLayout();
//Header
Label top = new Label("HEADER");
mainColumn.addComponent(top);
//The middle bit
final Panel middlePanel = new Panel();
middlePanel.setSizeFull();
middlePanel.getContent().setSizeUndefined();
middlePanel.setScrollable(true);
mainColumn.addComponent(middlePanel);
mainColumn.setExpandRatio(middlePanel, 1.0f);
//footer
Label bottom = new Label("FOOTER");
mainColumn.addComponent(bottom);
mainWindow.addComponent(mainColumn);
//test
Label test= new Label("This area should fill most of the screen.");
middlePanel.addComponent(test);
}
}
我哪里错了?我看到的是:
答案 0 :(得分:4)
尝试制作mainColumn.setSizeFull()
和mainWindow.setContent(mainColumn)