public void actionPerformed(ActionEvent a)
    {
    	int i = 0;
    	int j = 0;
        for(JButton button : buttons) {
        	if(a.getSource() == button) {
            	button.setText(play);
            	occupied[j][i] = true;
            	button.setEnabled(false);
        	}
        	if(i == 2) {j++; i = 0;}
        	else i++;
        }
    	/*if(a.getSource() == buttons[0]) {
        	buttons[0].setText(play);
        	occupied[0][0] = true;
        	buttons[0].setEnabled(false);
        }
        if(a.getSource() == buttons[1]) {
            buttons[1].setText(play);
            occupied[0][1] = true;
            buttons[1].setEnabled(false);
        }
        if(a.getSource() == buttons[2]) {
            buttons[2].setText(play);
            occupied[0][2] = true;
            buttons[2].setEnabled(false);
        }
        if(a.getSource() == buttons[3]) {
            buttons[3].setText(play);
            occupied[1][0] = true;
            buttons[3].setEnabled(false);
        }
        if(a.getSource() == buttons[4]) {
            buttons[4].setText(play);
            occupied[1][1] = true;
            buttons[4].setEnabled(false);
        }
        if(a.getSource() == buttons[5]) {
            buttons[5].setText(play);
            occupied[1][2] = true;
            buttons[5].setEnabled(false);
        }
        if(a.getSource() == buttons[6]) {
            buttons[6].setText(play);
            occupied[2][0] = true;
            buttons[6].setEnabled(false);
        }
        if(a.getSource() == buttons[7]) {
            buttons[7].setText(play);
            occupied[2][1] = true;
            buttons[7].setEnabled(false);
        }
        if(a.getSource() == buttons[8]) {
            buttons[8].setText(play);
            occupied[2][2] = true;
            buttons[8].setEnabled(false);
        }*/
        count++;
        testresults();
        if(win==true) {
            for(JButton button : buttons) {
            	button.setEnabled(false);
            }
            playerwins();
        }
        else
            computer();
    }