Pergunta

tabpane menu

My windows primary pane is an AnchorPane on top of which is a TabPane, the menu of that TabPane are the tabs you see on the picture. You see the grey "background" which is part of the TabPane, when I scale my window to a bigger size, the TabPane doesn't scale with it, it stays the same size, so extra space is blank, I would like it to scale with the window, in the width of course.

Foi útil?

Solução

You need to tell the AnchorPane to anchor its child (the TabPane) so that it is resized automatically when the window size changes.

If you are using Scene Builder you can achieve this by selecting the TabPane, going to the layout section of the properties window and setting the anchor properties.

enter image description here

Click on each of the dotted lines until it looks like the image below.

enter image description here

The same effect can also be set in code using the setXXXAnchor methods of the AnchorPane:

pane.setLeftAnchor(tabPane, 0.0);
pane.setRightAnchor(tabPane, 0.0);
pane.setTopAnchor(tabPane, 0.0);
pane.setBottomAnchor(tabPane, 0.0);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top