JavaFX 2.0 Tab Bar: Left Tabs and Header Header Header

I am trying to develop a GUI for a web application, and I wanted to install TabPane with tabs on the left, keeping horizontal headers. I already found how to place the tabs on the left, but after many searches, I was unable to set the headers in the correct alignment. They are still upright and hard to read.

How could I fix this?

+7
source share
6 answers

There is an open function request for this: RT-19547 New API for rotating text on tab tabs

The feature request is currently open, but not planned for implementation. You can vote or comment on a feature request and return to this StackOverflow post to register your interest in this feature.

To implement this yourself, you will need to create a new TabPane skin or fix an existing TabPane skin , which is probably not trivial.

+4
source

You can use CSS to customize tabs and tab shortcuts:

.tab *.tab-label { -fx-rotate: 90; } .tab { -fx-padding: 3em 0.5em 3em 0.5em; } 
+6
source

You can use the following method to create a tab title

 private StackPane createTabHeader(String text, Node graphics){ return new StackPane(new Group(new Label(text, graphics))); } 

Then call it in your code like this:

 Tab tab = new Tab(); tab.setGraphic(createTabHeader("TEXT", new ImageView("IMAGE_PATH"))); 

Please note that you need to set the width and height of the tabs, as they will not automatically scale.

 TabPane tabPane = new TabPane(tab); tabPane.setSide(Side.LEFT); tabPane.setTabMinWidth(50); tabPane.setTabMaxWidth(50); tabPane.setTabMinHeight(200); tabPane.setTabMaxHeight(200); 
+1
source
 // 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); 
0
source

has another solution, set minimum width and height on css and add graphic element on fxml

 -fx-tab-min-width:30; -fx-tab-max-width:30; -fx-tab-min-height:150; -fx-tab-max-height:150; <Tab closable="false"> <graphic> <Pane prefHeight="76.0" prefWidth="30.0"> <children> <Label layoutX="-35.0" layoutY="23.0" prefHeight="30.0" prefWidth="130.0" text="User"> <font> <Font name="SansSerif Regular" size="14.0" /> </font></Label> </children> </Pane> </graphic> </Tab> 
0
source

Oh, I remember that I came across this before, just add StackPane, VBox o Hbox inside the tabHeader and all the components that you might need, they will not follow the Orientation pointer.

0
source

All Articles