-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessBoardDisplay.java
More file actions
42 lines (37 loc) · 1.55 KB
/
ChessBoardDisplay.java
File metadata and controls
42 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import javax.swing.JButton;
/** Rules for how we want the chess board to display
*
*/
public interface ChessBoardDisplay {
/**
* The initial size of a square on the chess board, initially 1/40 the width of the screen
* @return the size of a square
*/
public default int getSquareSize() {
return java.awt.Toolkit.getDefaultToolkit().getScreenSize().width / 40;
}
/**
* Display a square that has no piece on it.
* @param button the button that is used for the chessboard square
* @param row the row of this square on the board
* @param column the column of this square on the board
*/
public void displayEmptySquare(JButton button, int row, int column);
/**
* Display a square that has a piece on it.
* @param button the button that is used for the chessboard square
* @param row the row of this square on the board
* @param column the column of this square on the board
* @param piece the piece that is on this square
*/
public void displayFilledSquare(JButton button, int row, int column, ChessPiece piece);
/**
* Highlight a square of the board.
* @param highlight do we want the highlight on (true) or off (false)?
* @param button the button that is used for the chessboard square
* @param row the row of this square on the board
* @param column the column of this square on the board
* @param piece the piece (if any) that is on this square
*/
public void highlightSquare(boolean highlight, JButton button, int row, int column, ChessPiece piece);
}