below is my current code i want to generate a black square in the corners highlighte 5150806
Below is my current code. I want to generate a black square in the corners highlighted in red. Then I would like to stack a slightly smaller white square on top of the black squares in the corners. This must be done in JavaFX.
import java.util.Random;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
public class Main extends Application {
int rowNum = 350;
int colNum = 350;
int gridHeight = 10; // to get bigger squares, increase gridHeight and gridWidth
int gridWidth = 10;
@Override
public void start(Stage primaryStage) {
try {
GridPane grid = new GridPane();
Random rand = new Random();
Color[] colors = { Color.BLACK, Color.WHITE };
for (int row = 0; row
for (int col = 0; col
int n = rand.nextInt(2);
Rectangle rec = new Rectangle();
rec.setWidth(10);
rec.setHeight(10);
rec.setFill(colors[n]);
GridPane.setRowIndex(rec, row);
GridPane.setColumnIndex(rec, col);
grid.getChildren().addAll(rec);
}
Rectangle q1 = new Rectangle(20, 20, 200, 200);
q1.setFill(Color.WHITE);
q1.setStroke(Color.BLACK);
}
Scene scene = new Scene(grid, 600, 600);
primaryStage.setTitle(“QR Code Sample”);
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
jfx8.cssext Application.class ava T010 Class.class T010 QR Code Sample } Scer prir pri pri } catch e.pr } } public stat Launch( }