void AI_attack() {
        boolean AI_win = false;
        String c1 = box1.getText();
        String c2 = box2.getText();
        String c3 = box3.getText();
        String c4 = box4.getText();
        String c5 = box5.getText();
        String c6 = box6.getText();
        String c7 = box7.getText();
        String c8 = box8.getText();
        String c9 = box9.getText();
        if ((i % 2) == 1) {
            if ((c1.equals(c2)) && (c2.equals("O")) && (b3 == 0)) {
                box3.setText("O");
                b3 = 1;
                i++;
                AI_win = true;
                AI_win = true;
            } else if ((c3.equals(c2)) && (c2.equals("O")) && (b1 == 0)) {
                box1.setText("O");
                b1 = 1;
                i++;
                AI_win = true;
            } else if ((c1.equals(c3)) && (c1.equals("O")) && (b2 == 0)) {
                box2.setText("O");
                b2 = 1;
                i++;
                AI_win = true;
            } else if ((c4.equals(c5)) && (c5.equals("O")) && (b6 == 0)) {
                box6.setText("O");
                b6 = 1;
                i++;
                AI_win = true;
            } else if ((c6.equals(c5)) && (c5.equals("O")) && (b4 == 0)) {
                box4.setText("O");
                b4 = 1;
                i++;
                AI_win = true;
            } else if ((c4.equals(c6)) && (c4.equals("O")) && (b5 == 0)) {
                box5.setText("O");
                b5 = 1;
                i++;
                AI_win = true;
            } else if ((c7.equals(c8)) && (c8.equals("O")) && (b9 == 0)) {
                box9.setText("O");
                b9 = 1;
                i++;
                AI_win = true;
            } else if ((c9.equals(c8)) && (c8.equals("O")) && (b7 == 0)) {
                box7.setText("O");
                b7 = 1;
                i++;
                AI_win = true;
            } else if ((c7.equals(c9)) && (c7.equals("O")) && (b8 == 0)) {
                box8.setText("O");
                b8 = 1;
                i++;
                AI_win = true;
            } else if ((c1.equals(c4)) && (c4.equals("O")) && (b7 == 0)) {
                box7.setText("O");
                b7 = 1;
                i++;
                AI_win = true;
            } else if ((c7.equals(c4)) && (c4.equals("O")) && (b1 == 0)) {
                box1.setText("O");
                b1 = 1;
                i++;
                AI_win = true;
            } else if ((c1.equals(c7)) && (c1.equals("O")) && (b4 == 0)) {
                box4.setText("O");
                b4 = 1;
                i++;
                AI_win = true;
            } else if ((c2.equals(c5)) && (c5.equals("O")) && (b8 == 0)) {
                box8.setText("O");
                b8 = 1;
                i++;
                AI_win = true;
            } else if ((c8.equals(c5)) && (c5.equals("O")) && (b2 == 0)) {
                box2.setText("O");
                b2 = 1;
                i++;
                AI_win = true;
            } else if ((c2.equals(c8)) && (c2.equals("O")) && (b5 == 0)) {
                box5.setText("O");
                b5 = 1;
                i++;
                AI_win = true;
            } else if ((c3.equals(c6)) && (c6.equals("O")) && (b9 == 0)) {
                box9.setText("O");
                b9 = 1;
                i++;
                AI_win = true;
            } else if ((c9.equals(c6)) && (c6.equals("O")) && (b3 == 0)) {
                box3.setText("O");
                b3 = 1;
                i++;
                AI_win = true;
            } else if ((c3.equals(c9)) && (c3.equals("O")) && (b6 == 0)) {
                box6.setText("O");
                b6 = 1;
                i++;
                AI_win = true;
            } else if ((c1.equals(c5)) && (c5.equals("O")) && (b9 == 0)) {
                box9.setText("O");
                b9 = 1;
                i++;
                AI_win = true;
            } else if ((c9.equals(c5)) && (c5.equals("O")) && (b1 == 0)) {
                box1.setText("O");
                b1 = 1;
                i++;
                AI_win = true;
            } else if ((c1.equals(c9)) && (c1.equals("O")) && (b5 == 0)) {
                box5.setText("O");
                b5 = 1;
                i++;
                AI_win = true;
            } else if ((c3.equals(c5)) && (c5.equals("O")) && (b7 == 0)) {
                box7.setText("O");
                b7 = 1;
                i++;
                AI_win = true;
            } else if ((c7.equals(c5)) && (c5.equals("O")) && (b3 == 0)) {
                box3.setText("O");
                b3 = 1;
                i++;
                AI_win = true;
            } else if ((c3.equals(c7)) && (c3.equals("O")) && (b5 == 0)) {
                box5.setText("O");
                b5 = 1;
                i++;
                AI_win = true;
            }

        }
        if (AI_win == true) {
            JOptionPane.showMessageDialog(null, "Computer Wins");
            refresh.doClick(1000);
        }
    }