2
我有一個FormLayout,我正在向VerticalSplit Panel注入,而我無法居中「TOMCAR」文本。我試過設置UndefinedSize並以HTML爲中心,但沒有運氣。Vaadin標籤對齊
我的代碼:
HorizontalSplitPanel panel = new HorizontalSplitPanel();
VerticalSplitPanel vpanel = new VerticalSplitPanel();
FormLayout leftLayout = new FormLayout();
FormLayout rightLayout = new FormLayout();
Label enter = new Label();
enter.setContentMode(ContentMode.HTML);
enter.setValue("<br></br>");
panel.setWidth(Page.getCurrent().getBrowserWindowWidth(), Sizeable.Unit.PIXELS);
panel.setSplitPosition((Page.getCurrent().getBrowserWindowWidth())/8, Sizeable.Unit.PIXELS);
panel.setLocked(true);
panel.setHeight(Page.getCurrent().getBrowserWindowHeight(), Sizeable.Unit.PIXELS);
viewBZ.setWidth("70%");
leftLayout.addComponent(viewBZ);
leftLayout.addComponent(configureAccount);
for (int i = 0; i < 5; i++) {
leftLayout.addComponent(enter);
}
leftLayout.addComponent(adminContact);
for (int i = 0; i < 10; i++) {
leftLayout.addComponent(enter);
}
leftLayout.addComponent(logout);
panel.addComponent(leftLayout);
content.addValueChangeListener(content);
vpanel.setHeight((Page.getCurrent().getBrowserWindowHeight())/8, Sizeable.Unit.PIXELS);
vpanel.setWidth((Page.getCurrent().getBrowserWindowWidth()) - (Page.getCurrent().getBrowserWindowWidth()/8) - 8, Sizeable.Unit.PIXELS);
vpanel.setLocked(true);
Label label = new Label();
label.setWidth(null);
label.setValue("<center>TOMCAR</center>");
rightLayout.setMargin(false);
rightLayout.setWidth(vpanel.getWidth() - panel.getWidth(), Sizeable.Unit.PIXELS);
rightLayout.setHeight((Page.getCurrent().getBrowserWindowHeight())/100, Sizeable.Unit.PIXELS);
rightLayout.addComponent(label);
rightLayout.setExpandRatio(label, 1.0f);
rightLayout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);
vpanel.addComponent(rightLayout);
vpanel.addComponent(content);
panel.addComponent(vpanel);
CssLayout css = new CssLayout(panel);
setCompositionRoot(css);
第二件事情是不是一個優先事項,但這些都進入妥善解決向下設置按鈕?也許有另一種方法來做到這一點?
謝謝:)
代碼太多,沒看過。把它降低到絕對最低限度來展示你的問題。請參閱:[如何創建最小,完整和可驗證示例](http://stackoverflow.com/help/mcve) –