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 Project then create a new package under that project named project
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:imagesimagenamepng
For example, one of the images is named WhiteQueen the path for this image is file:imagesWhiteQueenpng
After copying the images to the images package, Copy ChessBoard.java to your project 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 squares of the board. Each square will have at least one layerthe color and some squares will have a second layer added on the top of the color which will be one of the Chess piecesHint: Think of a structure that allows you to stack more than one NodeLayer 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.
of
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 BlackGrey 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 X 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, viseversa.
This is very important in order to have a userfriendly application.
Extra Credit points:
The initial size of the scene is X so the aspect ratio of the scene in our application is : 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 points as extra credit.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
