public void promotionClicked(int y) {
        if (!selectingPromotion) return;
        y-=100;
        y /= 50;

        if (y == 0) {
            promotionPiece = new Queen(promotionColor);
        } else if (y == 1) {
            promotionPiece = new Bishop(promotionColor);
        } else if (y == 2) {
            promotionPiece = new Knight(promotionColor);
        } else if (y == 3) {
            promotionPiece = new Rook(promotionColor);
        }

        synchronized (this) {
            this.notifyAll();
        }
    }