This is a Java Swing–based Tic-Tac-Toe game developed as a learning project by following a YouTube tutorial and implementing the concepts independently. The project helped me understand core Java, event-driven programming, and GUI development.
- To learn Java Swing GUI components
- To understand event handling using ActionListener
- To implement turn-based game logic
- To practice basic game state management
- Java (Core Java)
- Java Swing (GUI)
- AWT (Layouts, Events)
- 3×3 Tic-Tac-Toe game board
- Two-player turn-based gameplay (X and O)
- Random first turn selection
- Automatic win detection (rows, columns, diagonals)
- Visual highlight for winning combination
- Game-over state disables further moves
- Object-Oriented Programming (classes & objects)
- Event-driven programming
- GUI layout management (BorderLayout, GridLayout)
- ActionListener and ActionEvent handling
- Game logic and state control
- Make sure Java is installed on your system
- Clone this repository or download the source code
- Compile and run the
Main.javafile - The Tic-Tac-Toe window will open
This project was built by learning from a YouTube tutorial and rewriting the code with a clear understanding of each concept. The goal was learning and practice, not copying blindly.
- Draw (tie) condition handling
- Restart game button
- Single-player mode with basic AI
- Code refactoring using MVC architecture
##ScreenShots
Vaitheeshwaran
Biotechnology student learning Java and problem-solving for IT placements

