0
我使用邊界佈局視口有我的應用程序中添加視口。如何手風琴佈局
現在我需要這整個口中添加到手風琴佈局,我試圖通過創建一個手風琴面板做到這一點,然後創建了佈局FitLayout其他內容面板。新增視口在這個新創建的面板,然後最後加入這個小組,我的主要手風琴面板
相應的代碼是:
viewport = new Viewport();
viewport.setLayout(new BorderLayout());
menuBar = new ArmMenuBar();
createNorth();
createWest();
createEast();
createCenter();
createSouth();
//Added for Accordion Layout.
ContentPanel panel = new ContentPanel();
panel.setHeading("AccordionLayout");
panel.setBodyBorder(false);
panel.setLayout(new AccordionLayout());
ContentPanel cp = new ContentPanel();
cp.setAnimCollapse(false);
cp.setHeading("Portfolios Tab");
cp.setLayout(new FitLayout());
// registry serves as a global context
Registry.register(ClientConstant.VIEWPORT, viewport);
Registry.register(ClientConstant.ROOT_WEST_PANEL, west);
Registry.register(ClientConstant.ROOT_CENTER_PANEL, center);
Registry.register(ClientConstant.ROOT_EAST_PANEL, east);
// Registry.register(ClientConstant.ROOT_SOUTH_PANEL, south);
RootPanel.get().add(viewport);
KeyNav<ComponentEvent> key = new KeyNav<ComponentEvent>(viewport);
key.addKeyNavListener(new KeyNavListener() {
@Override
public void onEnter(ComponentEvent ce) {
System.out.println("");
}
});
//Added for Accordion Layout.
cp.add(viewport);
panel.add(cp);
但我從給定直線
下獲得類鑄件的錯誤((BorderLayout) viewport.getLayout()).hide(LayoutRegion.WEST);
這樣可以硬骨素幫我在這。