package chess123;
import javax.swing.*;
import java.awt.Color;
public class board{
public static void main (String [] args) {
for (int j = 1; j<=9; j++) {
if (j!=9) {
for (int i = 1; i<=8; i++) {
JFrame nf = new JFrame();
nf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
nf.setBounds(i*100, j*100, 100, 100);
nf.setUndecorated(true);
nf.setVisible(true);
if(i % 2 == 0 & j % 2 != 0) {
nf.getContentPane().setBackground(Color.BLACK);
}
else if(i % 2 != 0 & j % 2 == 0) {
nf.getContentPane().setBackground(Color.BLACK);
}
else if (i % 2 == 0 & j % 2 == 0) {
nf.getContentPane().setBackground(Color.WHITE);
}
else if (i % 2 != 0 & j % 2 != 0) {
nf.getContentPane().setBackground(Color.WHITE);
}
if (j == 9) {
for (int k = 1; k<=8; k++) {
JFrame count1 = new JFrame();
count1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
count1.setBounds(i*100, j*100, 100, 100);
count1.setUndecorated(true);
count1.setVisible(true);
String l = String.valueOf(k);
JLabel count = new JLabel();
count.setBounds(i*100, j*100, 100, 100);
count.setText(l);
count.setVisible(true);
count1.add(count);
}
}
}
}
}
}
}