//Standard chess board which can be used for chess, draughts etc import java.awt.*; public class draughtsChessBoard extends Canvas { public void chessBoard () { } public void paint (Graphics g) { g.setColor(new Color(75,141,221)); //Light blue g.fillRect(0,0,500,50); //North border g.fillRect(0,0,50,500); //West border g.fillRect(0,450,500,50); //South border g.fillRect(450,0,50,500); //East border g.setColor(new Color(255,255,255)); //White drawAllPlayerColour(g, 50, 50); g.setColor(new Color(0,0,0)); //Black drawAllPlayerColour(g, 100, 50); drawExtra(g); } private void drawRowTiles (Graphics g, int startX, int startY) //Draw each row tiles of a certain colour { for (int i = 0; i < 4; i++) { g.fillRect(startX, startY, 50, 50); startX += 100; } } private void drawAllPlayerColour (Graphics g, int startX, int startY) //Draw all Tiles of a certain colour { for (int i = 0; i < 8; i++) { drawRowTiles(g, startX, startY); startY += 50; if (startX == 50) { startX = 100; } else { startX = 50; } } } //Protected means it can only be used by this class, and classes extending it protected void drawExtra (Graphics g) //Any class extending the chess board can use this method to add extra things like player pieces { } }