我正在尝试在 javafx 中制作一个面板,并且我习惯将边框窗格作为主要场景。中心面板有 4 个窗口(main1、main2、main3、main4),左侧面板有导航菜单。
borderPane.setCenter(mainMenu1.getCenterMain1UI());
//borderPane.setCenter(mainMenu2.getCenterMain2UI());
//borderPane.setCenter(mainMenu3.getCenterMain3UI());
//borderPane.setCenter(mainMenu4.getCenterMain4UI());
public BorderPane getAppWindow(){
if (borderPane == null){
borderPane = new BorderPane();
borderPane.setTop(topPanel.getTopPanelUI());
borderPane.setBottom(bottomPanel.getBottomPanelUI());
borderPane.setLeft(leftPanel.getLeftPanelUI());
borderPane.setCenter(mainMenu.getCenterMainUI());
borderPane.setAlignment(borderPane.getCenter(), Pos.TOP_LEFT);
}
return borderPane;
}
在左侧面板控制器中
public class LeftPanelController {
public VBox leftPanelPane;
public Button btnLeftPanelMainmenu;
public Button btnLeftPanelDb;
public Button btnLeftPanelOfficeInfo;
public Button btnLeftPanelConfiguration;
public void btnLeftPanelMainmenuOnClickAction(ActionEvent e){
change border pane center to main
}
public void btnLeftPanelDbOnClickAction(ActionEvent e){
change border pane center to DB
}
public void btnLeftPanelOfficeInfoOnClickAction(ActionEvent e){
change border pane center to DB
}
public void btnLeftPanelConfigurationOnClickAction(ActionEvent e){
change border pane center to configuration
}
}