java
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JTicTacToe extends JApplet implements ActionListener
{
JLabel someText = new JLabel(" Enter the number of expected guest for the event: ");
JTextField firstNum = new JTextField(15);
JLabel test_two = new JLabel("");
Container test = getContentPane();
String letter4User = "O";
String letterForPC = "X";
String[] dummyInput = {" ", " ", " ", " ", " ", " ", " ", " ", " "};
int [] verify = { 0, 1, 2, 3, 4, 5, 6, 7, 8};
JButton[] TicTac = new JButton[dummyInput.length];
int random = ((int) (Math.random() * 100) % 9 + 1);
int count = 0;
int y;
Font convertion = new Font ("Bookman Old Style", Font.ITALIC, 13);
public void init()
{
test.setLayout(new FlowLayout());
firstNum.addActionListener(this);
for(int y = 0; y < dummyInput.length; y++)
{
TicTac[y] = new JButton(dummyInput[y]);
test.add(TicTac[y]);
TicTac[y].addActionListener(this);
}
}
public void actionPerformed(ActionEvent r)
{
Object source = r.getSource();
y = verify[y];
if(source == TicTac[0])
TicTac[0].setText(letter4User);
else
if(source == TicTac[1])
TicTac[1].setText(letter4User);
else
if(source == TicTac[2])
TicTac[2].setText(letter4User);
else
if(source == TicTac[3])
TicTac[3].setText(letter4User);
else
if(source == TicTac[4])
TicTac[4].setText(letter4User);
else
if(source == TicTac[5])
TicTac[5].setText(letter4User);
else
if(source == TicTac[6])
TicTac[6].setText(letter4User);
else
if(source == TicTac[7])
TicTac[7].setText(letter4User);
else
if(source == TicTac[8])
TicTac[8].setText(letter4User);
else
if(random == 1 )
TicTac[0].setText(letterForPC);
{
}
}
}
** Edit **

Fixed the ridiculously large font size