In JPanelChessBoard in setcolor, put (x+y)%2 == 0 instead of ==1 to
correct the chessboard.
This commit is contained in:
parent
ad70ff95d1
commit
40bd5cb73b
|
|
@ -16,7 +16,7 @@ public class Main {
|
|||
testBoard.getWidth();
|
||||
System.out.println(testBoard.toString());
|
||||
|
||||
Piece testPiece = new Piece(PieceType.Knight);
|
||||
Piece testPiece = new Piece();
|
||||
testPiece.getX();
|
||||
testPiece.getY();
|
||||
testPiece.getType();
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class JPanelChessBoard extends JPanel {
|
|||
if(isHighlight) {
|
||||
g.setColor(Color.yellow);
|
||||
}
|
||||
if((x+y)%2==1 || isSelect || isHighlight) {
|
||||
if((x+y)%2==0 || isSelect || isHighlight) {
|
||||
g.fillRect(
|
||||
Math.round(x*cellWidth),
|
||||
Math.round(y*cellHeight),
|
||||
|
|
|
|||
Loading…
Reference in New Issue