好吧,检查我的代码:
public MainForm() {
HorizontalPanel horizontalPanel = new HorizontalPanel();
initWidget(horizontalPanel);
VerticalPanel verticalPanel = new VerticalPanel();
horizontalPanel.add(verticalPanel);
MenuBar menuBar = new MenuBar(true);
verticalPanel.add(menuBar);
MenuBar menuBar_1 = new MenuBar(true);
MenuItem mntmNewMenu = new MenuItem("General", false, menuBar_1);
MenuItem mntmBuilding = new MenuItem("Building", false, (Command) null);
menuBar_1.addItem(mntmBuilding);
MenuItem mntmModularBuilding = new MenuItem("Modular Building", false, (Command) null);
menuBar_1.addItem(mntmModularBuilding);
menuBar.addItem(mntmNewMenu);
MenuBar menuBar_2 = new MenuBar(true);
MenuItem mntmNewMenu_1 = new MenuItem("New menu", false, menuBar_2);
mntmNewMenu_1.setHTML("EPC");
menuBar.addItem(mntmNewMenu_1); //target
MenuBar menuBar_3 = new MenuBar(true);
MenuItem mntmNewMenu_2 = new MenuItem("New menu", false, menuBar_3);
mntmNewMenu_2.setHTML("Constructions");
menuBar.addItem(mntmNewMenu_2);
MenuBar menuBar_4 = new MenuBar(true);
MenuItem mntmRecommendations = new MenuItem("Recommendations", false, menuBar_4);
menuBar.addItem(mntmRecommendations);
}
目前,带有“建筑”和“模块化建筑”选项的子菜单即将出现。如何更改代码以使子菜单出现在菜单栏选项下方?一些显示它们是子菜单的样式也会有所帮助。
非常感谢你