I have a BorderPane
with a ScrollPane
as the center element. It resizes automatically to fill the screen. Inside the ScrollPane
is a <
Setting the fitToHeight
or fitToWidth
attribute through XML
or CSS
:
FXML:
<ScrollPane fx:id="myScrollPane" fitToHeight="true" fitToWidth="true" />
CSS:
.my-scroll-pane {
-fx-fit-to-height: true;
-fx-fit-to-width: true;
}
Try
ScrollPane scrollPane = new ScrollPane();
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
without overriding the resize()
method.