1

I have a ScrollPane inside which a FlowPane resides. When I resize the window by dragging the edges the FlowPane does not grow! It stays in its fixed size. How can I resize the FlowPane when the ScrollPane is expanded by mouse?

I have tried many ways,but no luck! Here is my fxml code in its simplest form:

<ScrollPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1">
   <content>
      <FlowPane prefHeight="411.0" prefWidth="613.0" style="-fx-background-color: green;" />
   </content>
</ScrollPane>
Rafa
  • 467
  • 4
  • 18

1 Answers1

1

The answer was very simple. But do not know why no one answered it. After hours of testing I found the solution. I share the answer if someone else has the same problem.

          <ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="ALWAYS" prefHeight="670.0" prefWidth="434.0" vbarPolicy="ALWAYS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="6.0" AnchorPane.topAnchor="0.0">
Rafa
  • 467
  • 4
  • 18