Reputation: 521
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.
Upvotes: 1
Views: 8504
Reputation: 13177
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.
Click on each of the dotted lines until it looks like the image below.
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);
Upvotes: 6