r/JavaFX • u/Nareeeek • Jan 05 '25
Help How to make Gridpane scale with Scrollpane?
I have a gridplane(pretty large, bigger than screen area) and it’s wrapped in scrollpane. Now it works fine, the problem I am having is I can’t configure the gridplane to scale. Whenever I resize the application window, instead of rescaling, it just shows more rows/columns. Is there a way to make the gridplane resize with the scrollpane? The Scrollpane resizes with the window correctly.
2
Upvotes
View all comments
Show parent comment
1
u/Nareeeek Jan 05 '25
Hmm, I’m not sure you understood what I want to do, either that or I didn’t understand what you meant.
I have a gridview, larger than screen size, or the root container, which at the moment is an AnchorPane. To be able to scroll through the GridPane, I wrap it in a ScrollPane. But when resizing the window on the running application, the GridPane stays the same size, and does not scale with the screen. It just gives space to the rows which were hidden before. Now I’m wondering, if there is a way to “anchor” the part of the Gridpane I want to be visible to the ScrollPane, and instead of showing more rows when there is space, it scales the area of the visible GridPane. Essentially giving everything a limited area, so more or less rows are not visible when rescaling the window
Again, I’m sorry if I didn’t understand what you were saying, I’m just starting out on FX, with no prior experience in any type of UIs.