Commit 713c33f3 authored by kimia's avatar kimia

PieceColors

parent f6bd2726
...@@ -52,7 +52,7 @@ public class ChessBoardGUI extends JPanel { ...@@ -52,7 +52,7 @@ public class ChessBoardGUI extends JPanel {
if(moveBoard[finalI][finalJ] && source!=null && dest!=null){ if(moveBoard[finalI][finalJ] && source!=null && dest!=null){
movePiece(source,dest); movePiece(source,dest);
// System.out.println("Moves"); // System.out.println("Moves");
buttonRepaint(); buttonUpdate();
updateDeletedPanel(); updateDeletedPanel();
//---------------- //----------------
int condition = checkCondition(board,pw,pb); int condition = checkCondition(board,pw,pb);
...@@ -71,15 +71,15 @@ public class ChessBoardGUI extends JPanel { ...@@ -71,15 +71,15 @@ public class ChessBoardGUI extends JPanel {
updateGUIBoard(moveBoard); updateGUIBoard(moveBoard);
} }
if(wORb%2==0){ if(wORb%2==0){
turnLabel.setText("White Turn..."); turnLabel.setText("WHITE TURN!");
}else { }else {
turnLabel.setText("Black Turn..."); turnLabel.setText("BLACK TURN");
} }
} }
}); });
add(button[i][j]); add(button[i][j]);
if((i+j)%2==0) if((i+j)%2==0)
button[i][j].setBackground(Color.CYAN); button[i][j].setBackground(Color.LIGHT_GRAY);
else { else {
button[i][j].setBackground(Color.WHITE); button[i][j].setBackground(Color.WHITE);
} }
...@@ -91,11 +91,11 @@ public class ChessBoardGUI extends JPanel { ...@@ -91,11 +91,11 @@ public class ChessBoardGUI extends JPanel {
for (int i = 0 ; i < 8 ;i++){ for (int i = 0 ; i < 8 ;i++){
for (int j = 0 ; j < 2 ;j++) { for (int j = 0 ; j < 2 ;j++) {
removedPieces[i][j] = new JButton(); removedPieces[i][j] = new JButton();
removedPieces[i][j].setBackground(Color.YELLOW); removedPieces[i][j].setBackground(Color.PINK);
// added.setMinimumSize(new Dimension(50,50)); // added.setMinimumSize(new Dimension(50,50));
whiteRemovedPiecePanel.add( removedPieces[i][j]); whiteRemovedPiecePanel.add( removedPieces[i][j]);
removedPieces[i][3-j] = new JButton(); removedPieces[i][3-j] = new JButton();
removedPieces[i][3-j].setBackground(Color.YELLOW); removedPieces[i][3-j].setBackground(Color.PINK);
blackRemovedPiecePanel.add( removedPieces[i][3-j]); blackRemovedPiecePanel.add( removedPieces[i][3-j]);
} }
} }
...@@ -119,7 +119,7 @@ public class ChessBoardGUI extends JPanel { ...@@ -119,7 +119,7 @@ public class ChessBoardGUI extends JPanel {
} }
} }
} }
private void buttonRepaint(){ private void buttonUpdate(){
Piece[][] pieceBoard = getUpdatedBoard(); Piece[][] pieceBoard = getUpdatedBoard();
for (int i = 0 ;i<8 ;i++){ for (int i = 0 ;i<8 ;i++){
for (int j = 0 ; j < 8 ;j++){ for (int j = 0 ; j < 8 ;j++){
...@@ -129,7 +129,7 @@ public class ChessBoardGUI extends JPanel { ...@@ -129,7 +129,7 @@ public class ChessBoardGUI extends JPanel {
button[i][j].setIcon(new ImageIcon()); button[i][j].setIcon(new ImageIcon());
} }
if((i+j)%2==0) if((i+j)%2==0)
button[i][j].setBackground(Color.CYAN); button[i][j].setBackground(Color.LIGHT_GRAY);
else { else {
button[i][j].setBackground(Color.WHITE); button[i][j].setBackground(Color.WHITE);
} }
...@@ -145,7 +145,7 @@ public class ChessBoardGUI extends JPanel { ...@@ -145,7 +145,7 @@ public class ChessBoardGUI extends JPanel {
// System.out.println("Reach Thereeee..."); // System.out.println("Reach Thereeee...");
} else { } else {
if((i+j)%2==0) if((i+j)%2==0)
button[i][j].setBackground(Color.CYAN); button[i][j].setBackground(Color.LIGHT_GRAY);
else { else {
button[i][j].setBackground(Color.WHITE); button[i][j].setBackground(Color.WHITE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment