@Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    
    //paint the chess board
    g.drawImage(_bg, 0, 0, null);
    
    //paint the selector
    if (_drawSelector && !_board.emptyAt(_selectorX/Cell.SIZE, _selectorY/Cell.SIZE)) {
      g.drawImage(_selector, _selectorX, _selectorY, null);
    }
    
    //paint the pieces
    int x, y;
    for (y = 0; y < Board.SIZE; y++) {
      for (x = 0; x < Board.SIZE; x++) {
        if (!_board.emptyAt(x, y)) {
          g.drawImage(_board.getPieceImageAt(x, y), x*Cell.SIZE, y*Cell.SIZE, null);
        }
      }
    }
    
    if (_gameOver) {
      x = getWidth()/2 - _gameOverImg.getWidth(null)/2;
      y = getHeight()/2 - _gameOverImg.getHeight(null)/2;
      g.drawImage(_gameOverImg, x, y, null);
    }
    
  }