I have added a while loop that will change between players as seen in the code below. Before I add this while loop it displays the grid, buttons, etc but when I add this loop the panel is just plain white. I have no idea why.

```
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.security.auth.x500.X500Principal;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.omg.CORBA.PRIVATE_MEMBER;

public class Game 
{
    boolean p1;

    private int counterY1 = 515, counterY2 = 515, counterY3 = 515, counterY4 = 515;
    boolean playerTurn = true;
    boolean playerTurn2 = false;
    boolean moveLoop = true;

    public void moveC1Up()
    {
        counterY1 -= 51 * diceRoll();
    }
    public void moveC2Up()
    {
        counterY2 -= 51 * diceRoll();
    }
    public void moveC3Up()
    {
        counterY3 -= 51 * diceRoll();
    }
    public void moveC4Up()
    {
        counterY4 -= 51 * diceRoll();
    }

    public int diceRoll()
    {
        int randGen = (int)(Math.random()*1) + 1;
        System.out.print(randGen);
        return randGen; 
    }

    private JButton moveC1But, moveC2But, rollDiceButton;
    private JLabel amountRolledLabel;

    public Game()
    {

        JFrame window = new JFrame ("Main Game");
        final JPanel firstPanel = new JPanel(new GridLayout(3,1))
        {
            public void paintComponent(Graphics g)
            {   
                Graphics2D g2d = (Graphics2D) g;

                super.paintComponent(g2d);

                int width = getWidth() / 3;
                int height = getHeight() / 11;

                for (int i = 0; i < 4; i++) {
                    g.drawLine(i * width, 0, i * width, getHeight());
                }

                for (int i = 0; i < 11; i++) {
                    g.drawLine(0, i * height, getWidth(), i * height);
                }

                g.setColor(Color.DARK_GRAY);
                g.drawOval(220, counterY1, 40, 40);
                g.fillOval(220, counterY1, 40, 40);
                g.drawOval(300, counterY2, 40, 40);
                g.fillOval(300, counterY2, 40, 40);

                g.setColor(Color.LIGHT_GRAY);
                g.drawOval(410, counterY3, 40, 40);
                g.fillOval(410, counterY3, 40, 40);
                g.drawOval(490, counterY4, 40, 40);
                g.fillOval(490, counterY4, 40, 40);
            }
        };

        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(firstPanel, BorderLayout.CENTER);

        JPanel rightSidePanel = new JPanel(new GridLayout(10,1));
        moveC1But = new JButton("Move Counter 1");
        moveC2But = new JButton("Move Counter 2");
        rollDiceButton = new JButton("Roll Dice");
        rightSidePanel.add(moveC1But, BorderLayout.LINE_START);
        rightSidePanel.add(moveC2But, BorderLayout.LINE_END);
        rightSidePanel.add(rollDiceButton, BorderLayout.SOUTH);

        mainPanel.add(rightSidePanel, BorderLayout.EAST);

        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.getContentPane().add(mainPanel);
        window.setSize(700, 600);
        window.setLocationRelativeTo(null);
        window.setVisible(true);
        window.setResizable(false);

        while(moveLoop  == true)
        {
            moveC1But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC1Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });

            moveC2But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC3Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });
        }

    }   

    public static void main(String args[])
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                new Game();
            }
        });

    }

}

```

EDIT:

```
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.security.auth.x500.X500Principal;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.omg.CORBA.PRIVATE_MEMBER;

public class Game 
{
    boolean p1;

    private int counterY1 = 515, counterY2 = 515, counterY3 = 515, counterY4 = 515;
    boolean playerTurn = true;
    boolean playerTurn2 = false;
    boolean moveLoop = true;

    public void moveC1Up()
    {
        counterY1 -= 51 * diceRoll();
    }
    public void moveC2Up()
    {
        counterY2 -= 51 * diceRoll();
    }
    public void moveC3Up()
    {
        counterY3 -= 51 * diceRoll();
    }
    public void moveC4Up()
    {
        counterY4 -= 51 * diceRoll();
    }

    public int diceRoll()
    {
        int randGen = (int)(Math.random()*1) + 1;
        System.out.print(randGen);
        return randGen; 
    }

    private JButton moveC1But, moveC2But, rollDiceButton;
    private JLabel amountRolledLabel;

    public Game()
    {

        JFrame window = new JFrame ("Main Game");
        final JPanel firstPanel = new JPanel(new GridLayout(3,1))
        {
            public void paintComponent(Graphics g)
            {   
                Graphics2D g2d = (Graphics2D) g;

                super.paintComponent(g2d);

                int width = getWidth() / 3;
                int height = getHeight() / 11;

                for (int i = 0; i < 4; i++) {
                    g.drawLine(i * width, 0, i * width, getHeight());
                }

                for (int i = 0; i < 11; i++) {
                    g.drawLine(0, i * height, getWidth(), i * height);
                }

                g.setColor(Color.DARK_GRAY);
                g.drawOval(220, counterY1, 40, 40);
                g.fillOval(220, counterY1, 40, 40);
                g.drawOval(300, counterY2, 40, 40);
                g.fillOval(300, counterY2, 40, 40);

                g.setColor(Color.LIGHT_GRAY);
                g.drawOval(410, counterY3, 40, 40);
                g.fillOval(410, counterY3, 40, 40);
                g.drawOval(490, counterY4, 40, 40);
                g.fillOval(490, counterY4, 40, 40);
            }
        };

        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(firstPanel, BorderLayout.CENTER);

        JPanel rightSidePanel = new JPanel(new GridLayout(10,1));
        moveC1But = new JButton("Move Counter 1");
        moveC2But = new JButton("Move Counter 2");
        rollDiceButton = new JButton("Roll Dice");
        rightSidePanel.add(moveC1But, BorderLayout.LINE_START);
        rightSidePanel.add(moveC2But, BorderLayout.LINE_END);
        rightSidePanel.add(rollDiceButton, BorderLayout.SOUTH);

        mainPanel.add(rightSidePanel, BorderLayout.EAST);

        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.getContentPane().add(mainPanel);
        window.setSize(700, 600);
        window.setLocationRelativeTo(null);
        window.setVisible(true);
        window.setResizable(false);

        if(playerTurn == true)
        {

            moveC1But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC1Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });

            moveC2But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC2Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });
        }else if (playerTurn2 == true)
        {
            moveC1But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC3Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });
            moveC2But.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) 
                {

                    diceRoll();
                    moveC4Up();
                    firstPanel.repaint();
                    System.out.print(diceRoll());
                    System.out.print("Test1");
                    playerTurn = false;
                    playerTurn2 = true;
                    moveLoop = false;

                }
            });
        }

        }

    public static void main(String args[])
    {
        SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                new Game();
            }
        });

    }

```