1
votes

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
Can you explain what you're trying to do? If you really want fitToHeight and fitToWidth to be true, it doesn't seem to make much sense to use a ScrollPane at all.James_D
I'm trying to make just the center of my screen scrollable. But the width and height of the content of the Scrollpane is not fixed. I want my Scrollpane to automatically adjust its size to fit the content. I found out, that the error cause UPDATE: It already works :)pichlbaer

1 Answers

2
votes

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