I am researching javafx and I would like to have multiple buttons on screen. All of them should be of the same size (for easy tap with finger on touch screens) and should be arranged in grids.

Is there a layout that can handle this automatically by just adding buttons in it or should I write my own handler? It should be responsive so when user resize window it should automatically be aligned.

For example if buttons are 100px wide and window is 450px wide it should have 4 buttons per one row. If user resize it so it is 550px wide then it should rearange them to 5 buttons per row.

Is this achievable without custom implementation?

Btw, I am working with java 11.

0 Answers