Question: In IntelliJ, create a project name Project 2 , then create a new package under that project named project 2 . Create a folder for

In IntelliJ, create a project name Project2, then create a new package under that project named project2.
Create a folder for the image files and name it images.
Copy all the image files you downloaded to the images folder, so whenever you are using an image the path for that image should be file:images/imagename.png,
For example, one of the images is named WhiteQueen, the path for this image is file:images/WhiteQueen.png
After copying the images to the images package, Copy ChessBoard.java to your project2 package, this class have an instance pane of type GridPane and two methods to be completed.
Complete the colorBoard() method, the purpose of this method is to setup each of the 64 squares of the board. Each square will have at least one layer(the color) and some squares will have a second layer added on the top of the color which will be one of the Chess pieces(Hint: Think of a structure that allows you to stack more than one Node/Layer on the top of the others). Stop reading and think of this for a second before continuing.
The squares of the board are arranged in two alternating colors, light and dark, in our application we will use White and Grey.
3 of 3
Did you figure it out? Alright, I will give another hint: Use a StackPane.
Complete the setupBoard() method, the purpose of this method is to place the pieces on the Chess Board. You are not restricted on how to complete this method. But you need to iterate over the board and manipulate every square. Remember, the board is a GridPane and each square of the board is a StackPane.
The pieces are placed on the White and Black(Grey in our application) side of the board in the same manner. In the first row beginning at both outer edges and moving inward, place the Rook, the Knight and the Bishop. For the two remaining squares, place the Queen on the square with the same color. Place the King on the final square. On the second row place a row of pawns.
The default size for the scene is 320 X 320, but resizing the stage should result in resizing the squares and the pieces. All the squares and pieces sizes have to be bound to the size of the scene. So If the scene size grows, the squares and pieces must grow too, vise-versa.
This is very important in order to have a user-friendly application.
Extra Credit 1(5 points):
The initial size of the scene is 320 X 320, so the aspect ratio of the scene in our application is 1:1, try to keep the aspect ratio the same when resizing the scene, so the GUI is always a square. If you complete this part, you will get 5 points as extra credit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!