I am new to JAVA and I am trying to make a simple Tic Tac Toe game to learn the language better. The below code works! It uses a Jframe and the computer isn't too easy! However, the code is getting long and I think I might be missing some steps on how to make it shorter and more concise. I was thinking about creating multiple class and importing them but I am not sure. If you have any ideas on how to make it more compact please let me know.
There's a nine-fold code duplication in the actionPerformed method that should be easy to get rid of. At a quick glance, the only thing that differs between those code blocks is the number 0...8 in 3 places - instead, you can use a loop from 0...8.