See the task that was about drawing a chessboard. Here is the code from the draw a chessboard task. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane;...

See the task that was about drawing a chessboard. Here is the code from the draw a chessboard task.

import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage;


public class DrawChessBoard extends Application {


public static void main(String[] args) { launch(args); }


@Override public void start(Stage stage) throws Exception { Pane grid = new Pane(); boolean trigger =false; for(int i=0;i for(int j=0;j Rectangle rect = new Rectangle(i*80,j*80,80,80); if(trigger){ rect.setFill(Color.BLACK); trigger = !trigger; }else{ trigger = !trigger; rect.setFill(Color.WHITE); } grid.getChildren().addAll(rect); } trigger = !trigger; } Scene scene = new Scene(grid, 630, 630, Color.WHITESMOKE); stage.setScene(scene); stage.setTitle("Chess (::)"); stage.setResizable(false); stage.show();



}


Change the solution so you can re-size the chessboard; - The chessboard should fill the entire window.



Hint: bind x, y, height and width properties in the rectangles to the height and width properties of the panel.


package gui;



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here