A personal collection of Java practice programs, exercises, games and networking/server projects, everything from AWT/Swing UI demos and exam preparation exercises to playable Swing games and a Vosk-powered speech recognizer.
Note: This is a learning repository. It mixes standalone source files, Swing/AWT UI projects and a Maven-based speech-recognition app. The general-purpose Java files are not part of a single build; you compile and run each file individually (instructions below).
| Folder | What's inside |
|---|---|
| Action Events/ | AWT event-handling demos (action, item, key, mouse, focus, window events) |
| Applet/ | A classic Java applet example (First.html + First.java) |
| AWT/ | AWT UI examples, dialogs, frames, menus, a student registration form |
| Exam-Prep/ | OOP, interfaces, packages, exceptions, threads and small simulations (coffee shop, restaurant, to-do) |
| File Handling/ | File I/O examples, read/write files, copy between files, vowel-word copier |
| Games/ | Playable Swing games, Snake, Tetris, Breakout, Flappy Bird, Pong, Minesweeper, Frogger, Space Invaders, Pac-Man, Tic-Tac-Toe, Dino Runner |
| IntelliJ Projects/ | Programs imported from a previous IntelliJ IDEA workspace (games, calculators, console programs) |
| JDBC/ | JDBC database examples (scrollable results, interactive console app) |
| LayoutManager/ | Swing layout manager demos, Grid, Border, Flow, GridBag, Group, null and nested layouts |
| Practical/ | Practical-lab programs, room/rectangle classes, simple-interest calculator, employee details form and DB |
| Practice/ | Swing practice, widgets, menus, dialogs, popups, color/file choosers and a small socket client/server |
| Servers and sockets/ | Networking, TCP/UDP chat, file transfer, RMI "Hello", URL/HTTP, JavaMail, JavaFX UI samples |
| SpeechRecognizer/ | Maven project, real-time speech-to-text using Vosk (mic input) |
Plus a handful of root-level scratch programs (arrayAge, numberGame, primes, pattern, newFile, task).
- JDK 17+ (many programs use modern syntax:
switchexpressions, text blocks, pattern matching). Check with:java -version - No external build tool is required for most folders, just the JDK.
- SpeechRecognizer additionally needs Apache Maven (and a downloaded Vosk model, see its README).
Because these are standalone files, run them directly with javac + java:
# 1. Go into a folder
cd Games
# 2. Compile a single program
javac SnakeGame.java
# 3. Run it
java SnakeGameSome files (e.g. IntelliJ Projects/DiceRolling.java, SpeechRecognizer) contain non-ASCII characters. On Windows, tell the compiler to read them as UTF-8:
javac -encoding UTF-8 DiceRolling.java && java DiceRollingAWT/Swing programs (folders like AWT, LayoutManager, Practice) compile and run the same way, a window will appear when you run them:
cd LayoutManager
javac FlowLayoutDemo.java
java FlowLayoutDemoPrograms in Servers and sockets/ run in two terminals, e.g. TCP chat:
# Terminal 1, server
cd "Servers and sockets/Chat server"
javac TCPChatServer.java && java TCPChatServer
# Terminal 2, client
javac TCPChatClient.java && java TCPChatClientcd SpeechRecognizer
mvn compile exec:java # or: mvn package && java -jar target/SpeechRecognizer-1.0-SNAPSHOT.jarFull setup (model download, dependencies) is in SpeechRecognizer/README.md.
Each game is a Swing app with its own controls. Quick table:
| Game | Source | Controls |
|---|---|---|
| Snake | Games/SnakeGame.java |
Arrow keys |
| Tetris | Games/Tetris.java |
Arrows + space/rotate |
| Breakout | Games/BreakoutGame.java |
Mouse / arrow keys |
| Flappy Bird | Games/FlappyBird.java |
SPACE |
| Space Invaders | Games/space-invaders-java/ |
Arrows + SPACE |
| Pac-Man | Games/pacman-java/ |
Arrow keys |
| Pong | Games/PongGame.java |
Mouse / keys |
| Minesweeper | Games/Minesweeper.java |
Mouse click |
| Frogger | Games/Frogger.java |
Arrow keys |
| Dino Runner | Games/DinoRunner.java |
SPACE |
See Games/README.md for details.
Each folder ships with its own README:
- Action Events
- Applet
- AWT
- Exam-Prep
- File Handling
- Games
- IntelliJ Projects
- JDBC
- LayoutManager
- Practical
- Practice
- Servers and sockets
- SpeechRecognizer
Compiled artifacts and local/IDE files are not committed:
*.classcompiled bytecodetarget/(Maven output),out/,bin/- IDE folders:
.idea/,*.iml,.vscode/,.project,.classpath SpeechRecognizer/libs/(jars resolved by Maven) andSpeechRecognizer/models/(download the model separately)- Runtime data files (
received_file.txt,employee_details.txt) - OS junk (
.DS_Store,Thumbs.db), logs
Although this repo is mostly personal learning material, contributions are welcome, fixes, better comments, new games, or documentation improvements. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Distributed under the MIT License. See LICENSE for details.
See CHANGELOG.md for the version history.