Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
Chess
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9631408
Chess
Commits
713c33f3
Commit
713c33f3
authored
May 23, 2019
by
kimia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PieceColors
parent
f6bd2726
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
ChessBoardGUI.java
src/ChessBoardGUI.java
+9
-9
No files found.
src/ChessBoardGUI.java
View file @
713c33f3
...
...
@@ -52,7 +52,7 @@ public class ChessBoardGUI extends JPanel {
if
(
moveBoard
[
finalI
][
finalJ
]
&&
source
!=
null
&&
dest
!=
null
){
movePiece
(
source
,
dest
);
// System.out.println("Moves");
button
Repaint
();
button
Update
();
updateDeletedPanel
();
//----------------
int
condition
=
checkCondition
(
board
,
pw
,
pb
);
...
...
@@ -71,15 +71,15 @@ public class ChessBoardGUI extends JPanel {
updateGUIBoard
(
moveBoard
);
}
if
(
wORb
%
2
==
0
){
turnLabel
.
setText
(
"W
hite Turn...
"
);
turnLabel
.
setText
(
"W
HITE TURN!
"
);
}
else
{
turnLabel
.
setText
(
"B
lack Turn...
"
);
turnLabel
.
setText
(
"B
LACK TURN
"
);
}
}
});
add
(
button
[
i
][
j
]);
if
((
i
+
j
)%
2
==
0
)
button
[
i
][
j
].
setBackground
(
Color
.
CYAN
);
button
[
i
][
j
].
setBackground
(
Color
.
LIGHT_GRAY
);
else
{
button
[
i
][
j
].
setBackground
(
Color
.
WHITE
);
}
...
...
@@ -91,11 +91,11 @@ public class ChessBoardGUI extends JPanel {
for
(
int
i
=
0
;
i
<
8
;
i
++){
for
(
int
j
=
0
;
j
<
2
;
j
++)
{
removedPieces
[
i
][
j
]
=
new
JButton
();
removedPieces
[
i
][
j
].
setBackground
(
Color
.
YELLOW
);
removedPieces
[
i
][
j
].
setBackground
(
Color
.
PINK
);
// added.setMinimumSize(new Dimension(50,50));
whiteRemovedPiecePanel
.
add
(
removedPieces
[
i
][
j
]);
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
]);
}
}
...
...
@@ -119,7 +119,7 @@ public class ChessBoardGUI extends JPanel {
}
}
}
private
void
button
Repaint
(){
private
void
button
Update
(){
Piece
[][]
pieceBoard
=
getUpdatedBoard
();
for
(
int
i
=
0
;
i
<
8
;
i
++){
for
(
int
j
=
0
;
j
<
8
;
j
++){
...
...
@@ -129,7 +129,7 @@ public class ChessBoardGUI extends JPanel {
button
[
i
][
j
].
setIcon
(
new
ImageIcon
());
}
if
((
i
+
j
)%
2
==
0
)
button
[
i
][
j
].
setBackground
(
Color
.
CYAN
);
button
[
i
][
j
].
setBackground
(
Color
.
LIGHT_GRAY
);
else
{
button
[
i
][
j
].
setBackground
(
Color
.
WHITE
);
}
...
...
@@ -145,7 +145,7 @@ public class ChessBoardGUI extends JPanel {
// System.out.println("Reach Thereeee...");
}
else
{
if
((
i
+
j
)%
2
==
0
)
button
[
i
][
j
].
setBackground
(
Color
.
CYAN
);
button
[
i
][
j
].
setBackground
(
Color
.
LIGHT_GRAY
);
else
{
button
[
i
][
j
].
setBackground
(
Color
.
WHITE
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment