如何在JFX中将OnSelectionChange设置为我的Tab

时间:2016-12-28 14:13:23

标签: java tabs selection jfxpanel

我已经设法在初始化时创建一个JFoenix tabpane。但是,我不知道如何在选择选项卡时设置某些操作。以下是我的代码!

            tabPanel = new JFXTabPane();
            tabPanel.setPrefSize(440, 50);


            tab = new Tab(); 
            tab.setText("My Events");

            tab2 = new Tab(); 
            tab2.setText("Categories");

            tab3 = new Tab(); 
            tab3.setText("Suggested Events");
            tab3.setId("suggestedEventsTab");




            tabPanel.getTabs().add(tab);
            tabPanel.getTabs().add(tab2);
            tabPanel.getTabs().add(tab3);



            VBox tabBox = new VBox(); 
            tabBox.setPrefSize(446, 100);



            Pane tabPane = new Pane(); 
            tabPane.setPrefSize(450, 100);


            VBox.setMargin(tabPanel, new Insets(33 , 0 , 17 , 0));


            tabBox.getChildren().add(tabPanel);
            tabPane.getChildren().add(tabBox);

            TopPane.getChildren().add(tabPane);

            SingleSelectionModel<Tab> selectionModel = tabPanel.getSelectionModel();

//

提前谢谢!干杯