androiddev
androiddev

Reputation: 67

How to increase the size of a pane and scroll around in javafx?

I have a grid node at the center of a pane and 10 other grid nodes are added around it which appear on the screen. But when i try to increase the no. of grid nodes to 20 most of them go off screen. Is there a way to increase the size of the pane and scroll it?

Upvotes: 0

Views: 50

Answers (1)

hotzst
hotzst

Reputation: 7496

You can add your GridPane into a ScrollPane:

GridPane gridPane = ...
ScrollPane scrollPane = new ScrollPane();
scrollPane.setContent(gridPane);

See some more examples: http://www.java2s.com/Tutorials/Java/JavaFX/0350__JavaFX_ScrollPane.htm

Upvotes: 1

Related Questions