Java FX8 tabs on the left side with horizontal tabs

I need a tabbed bar with tabs on the left side, the text / graphics of the tabs should be horizontal

I did this on Scenebuilder a few months ago.

However, when I add additional tabs using Java code, the tabs are on the left side, but the graphic text is vertical, unlike tabs created using the scene builder.

In the attached image, the first two tabs are created using Scenebuilder, and they are in the correct orientation, the third is dynamically added using Java code.

Tab studentAdmission = new Tab();
        studentAdmission.setContent((Parent)new FXMLLoader(getClass().getResource("Customer_View.fxml")).load());


        studentAdmission.setGraphic(new Label("Student Admission"));
        mainTab.getTabs().add(studentAdmission);

enter image description here

Can someone tell me why this tab does not rotate like the other.

+4
source share
2

, StackPane, , , .

  Tab studentAdmission = new Tab();
     studentAdmission.setContent((Parent)new FXMLLoader(getClass().getResource("Customer_View.fxml")).load());

    Label l = new Label("Student Admission");
    l.setRotate(90);
    StackPane stp = new StackPane(new Group(l));
    studentAdmission.setGraphic(stp);
    mainTab.getTabs().add(studentAdmission);

enter image description here

+5
    // Firstly
    tabPane.setSide(Side.LEFT);
    tabPane.setRotateGraphic(true);        

    Label l = new Label("Titel Tab1");
    l.setRotate(90);
    StackPane stp = new StackPane(new Group(l));
    stp.setRotate(90);
    tab1.setGraphic(stp);

    l = new Label("Titel Tab2");
    l.setRotate(90);
    stp = new StackPane(new Group(l));
    stp.setRotate(90);
    tab2.setGraphic(stp);

    tabPane.setTabMinHeight(100);
    tabPane.setTabMaxHeight(100);
+1

Source: https://habr.com/ru/post/1544572/


All Articles