That won't work; it sets the button to X regardless. What you want is to set the buttons enabled, or otherwise, maybe using a suitable method from the JButton API. Put a call to whichever method inside the actionPerformed method, then it becomes impossible to click the same button twice.
This sort of thing is usually discussed on the Swing forum, so I shall move you there.
One simple solution: only allow the button to be set if its text equals "?":
Having said that, note that this is a somewhat fragile solution in that it breaks if you ever decide to change the default text of the buttons. If this were my project, I'd use it to practice creating a MVC program, and just have my model set in such a way that it won't change the state of the grid item if it has already been set.
Are you having the user play tic-tac-toe against the computer?
I didn't look too closely at your code, but I would probably use some kind of Boolean variable to determine whose turn it is. As soon as one side makes a move, the value of the variable changes. Then, whatever method you have that responds to the user's clicks, have that method check the value of the Boolean variable, and if it is not the user's turn then do nothing in response to the click.
Would setting the buttons to unenabled (setEnabled(false)) help at all? You could still see the X or O on the button but it would no longer respond to being clicked. You can still get values from the buttons, though. Not sure if this will help, I just gave the code a quick once over.