shivajikobardan
Legendary Coder
I wanted to fit the 4x4 grid in a window when it is resized.
blackbox would provide me this code.
I have read some tidbits about javafx binding in Java textbook but I would love some further detailing research. Any materials are welcome. your insights from other programming languages are also welcome.
blackbox would provide me this code.
Java:
Pane pane = new Pane();
int gridSize = 4;
for (int y = 0; y < gridSize; y++) {
for (int x = 0; x < gridSize; x++) {
Rectangle r = new Rectangle();
r.setFill(Color.WHITE);
r.setStroke(Color.RED);
r.widthProperty().bind(pane.widthProperty().divide(gridSize));
r.heightProperty().bind(pane.heightProperty().divide(gridSize));
r.xProperty().bind(pane.widthProperty().divide(gridSize).multiply(x));
r.yProperty().bind(pane.heightProperty().divide(gridSize).multiply(y));
pane.getChildren().add(r);
}
}
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setTitle("Four By Four Grid");
primaryStage.show();
I have read some tidbits about javafx binding in Java textbook but I would love some further detailing research. Any materials are welcome. your insights from other programming languages are also welcome.