Javafx - Fit ScrollPane Size to content


Question

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
1
11/26/2014 12:38:03 AM

Accepted Answer

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

2
11/26/2014 8:37:31 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon