I have a BorderPane
and its center pane is GridPane
.
The GridPane
has 20x20 rectangle objects
for (int rows = 0; rows < GRID_SIZE; ++rows) {
for (int cols = 0; cols < GRID_SIZE; ++cols) {
Rectangle r = new Rectangle(RECTANGLE_SIZE, RECTANGLE_SIZE);
grid.add(r, rows, cols);
The grid.add
method accepts:
Node child - r, column and row index.
How could I access the grid using this index
my BorderPane
is static for the class
private static BorderPane bp = new BorderPane();
So when I type bp.getCenter (the grid) I can't find any appropriate method for inserting column and row index, which would return my Rectangle
object ?
Edit: solution JavaFX: Get Node by row and column