In class my teacher ran a program similar to this one. When I attempt to run this from home I get a message saying "No main classes found". I know there should be a main in the program but he ran a similar program without it. Just trying to get some insight on how to run this. This is basically just a program that makes a checkerboard pattern then it draws the checkers on top.

package checkers1;
import java.awt.*;
public  class Checkers1 {
static
    int columns = 8;
    int rows = 8;
    int sizeofsquare = 50;
   

    void maketheboard(Graphics g) {
        for(int row = 0; row<rows; row++)
            for(int column = 0; column<columns; column++){
                if((row+column)% 2==0)
                {
                    g.setColor(Color.LIGHT_GRAY);
                }
        else
            g.setColor(Color.GRAY);
            g.fillRect(20+column*sizeofsquare,20+row*sizeofsquare,
                    sizeofsquare,sizeofsquare);
    }

}

   private void checkerTime(Graphics g) {
         for(int row = 0; row<rows; row++)
              for(int column = 0; column<columns; column++)
                  if((row+column)% 2==1)
                      if (row <3)
                      {
                          g.setColor(Color.white);
                          g.fillOval(20+column*sizeofsquare, 20+row*sizeofsquare,
                                  sizeofsquare-2, sizeofsquare-2);

         if (row >= rows -3)
         {
             g.setColor(Color.black);
             g.fillOval(20+column*sizeofsquare,20+row*sizeofsquare,
                     sizeofsquare-2, sizeofsquare-2);
                          }
                      }
    
    }
  public void draw(Graphics g)
    {
        maketheboard(g);
        checkerTime(g);
}
}

Start this as an applet

package checkers1;
import java.awt.Graphics;
import javax.swing.JApplet;
public class Check extends JApplet {

    private Checkers1 ck;

    @Override
    public void init() {
        super.init();
        ck = new Checkers1();
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        ck.draw(g);
    }
}

Edited 6 Years Ago by quuba: n/a

sure thing....but how do I do that? lol :)

NVM I FOUND IT lol

Edited 6 Years Ago by Alkaline8214: n/a

This question has already been answered. Start a new discussion instead.