Javafx - Fit ScrollPane Size to content

3.8k views Asked by At

I've got a really annoying problem. I want my ScrollPane to fit my content, but the properties fitToHeight and fitToWidth aren't working.

<ScrollPane
        id="topPane"
        fitToHeight="true"
        fitToWidth="true">

    <content>    
        <GridPane
                hgap="15"
                vgap="15"
                alignment="CENTER"
                minHeight="1000"
                minWidth="1000">

               ..............[Something else]............

       </GridPane>
    </content>
</ScrollPane>

I tried to google it, but I didn't find an appropriate answer.

regards,

Dom

1

There are 1 answers

0
javaHunter On BEST ANSWER

You can just put the scrollPane in a VBox and give it a Vgrow Priority of Always.