An interactive desktop application for learning Java Swing GUI development through hands-on, task-based programming exercises.
Java Swing Tutor is a comprehensive educational platform designed to teach Java Swing library through an engaging, interactive learning experience. The application provides a structured curriculum with lessons, coding tasks, real-time code compilation, and progress tracking.
- π Structured Learning Path: 50+ lessons covering Java Swing fundamentals to advanced topics
- βοΈ Interactive Code Editor: Syntax-highlighted editor with intelligent code completion
- β Task-Based Learning: Step-by-step tasks with instant feedback and validation
- π Real-Time Code Execution: Compile and preview your Swing applications instantly
- π Progress Tracking: Monitor your learning progress with completed task tracking
- π Multi-Language Support: Available in English, Russian, Spanish, and Italian
- π Reference Documentation: Built-in documentation for each lesson
- π User Authentication: Secure registration and login system
- π‘ Intelligent Validation: Advanced code checking to ensure correct solutions
Java Swing Tutor serves as a comprehensive learning tool for:
- Students learning Java GUI development
- Educators teaching Swing programming concepts
- Developers looking to refresh or enhance their Swing skills
- Organizations providing structured training programs
The application combines theoretical knowledge with practical exercises, allowing learners to immediately see the results of their code in a visual, interactive environment.
The project follows a multi-module Maven architecture:
domain: Shared DTOs, request/response models, and domain entities used across modulesflyway: Database migrations (SQL only); consumed by the service classpath and by the Flyway Docker image / K8s Jobservice: Spring Boot REST API backend providing:- User authentication and management
- Lesson and task management
- Code validation and checking services
- Progress tracking
- Documentation and reference materials
desktop-client: Java Swing desktop application featuring:- Modern, dark-themed UI
- Code editor with syntax highlighting
- Task navigation and management
- Real-time code compilation
- User session management
- Java 25: Latest Java features and performance improvements
- Spring Boot 4.0.1: Modern Spring framework for backend services
- PostgreSQL 17: Robust relational database for data persistence
- Flyway: Database migration and versioning
- Maven 3.9+: Build automation and dependency management
- Docker & Docker Compose: Containerized deployment
- Java Swing: Desktop GUI framework
Before starting, ensure you have the following installed:
- JDK 25 (Java Development Kit)
- Maven 3.9+ (Build tool)
- Docker & Docker Compose (For database and backend service)
- Git (Version control)
Start the PostgreSQL database and Spring Boot service using Docker Compose:
docker compose up --buildThis command will:
- Start PostgreSQL database on port 5450 (mapped from container port 5432)
- Run Flyway database migrations automatically
- Build and start the Spring Boot REST API service on port 8080
The backend service will be available at http://localhost:8080
Note: The first startup may take a few minutes as Docker builds the service image and runs all database migrations.
In a new terminal, build the desktop client application:
mvn clean package -pl desktop-client -amThis produces a runnable JAR file:
desktop-client/target/desktop-client-<version>.jar
Launch the desktop application:
java -jar desktop-client/target/desktop-client-<version>.jarThe client automatically connects to the backend service at http://localhost:8080.
- Register a new account or sign in with existing credentials
- Select a lesson from the dropdown menu
- Choose a task to work on
- Read the documentation on the right panel for guidance
- Write your code in the editor
- Click "Run Code" to preview your Swing application
- Click "Check" to validate your solution
- Track your progress as tasks are marked as completed
| Variable | Description | Default |
|---|---|---|
JAVA_SWING_TUTOR_SERVICE_URL |
Backend service URL | http://localhost:8080 |
JAVA_SWING_TUTOR_USE_REMOTE |
Use REST API for data access | true |
JAVA_SWING_TUTOR_USE_DB |
Fallback to direct database access | false |
JAVA_SWING_TUTOR_SMTP_USERNAME |
SMTP username for email verification (optional) | - |
JAVA_SWING_TUTOR_SMTP_PASSWORD |
SMTP password for email verification (optional) | - |
| Variable | Description | Default |
|---|---|---|
JAVA_SWING_TUTOR_DATABASE_URL |
PostgreSQL connection URL | jdbc:postgresql://localhost:5450/java_swing_tutor |
JAVA_SWING_TUTOR_DATABASE_USER |
Database username | java_swing_tutor |
JAVA_SWING_TUTOR_DATABASE_PASSWORD |
Database password | java_swing_tutor |
JAVA_SWING_TUTOR_SERVICE_PORT |
Service port | 8080 |
SPRING_PROFILES_ACTIVE |
Spring profile (dev/docker) | dev |
The docker-compose.yml file configures:
- PostgreSQL database on port 5450
- Flyway migrations that run automatically
- Spring Boot service on port 8080
Database credentials (Docker environment):
- Database:
java_swing_tutor - User:
java_swing_tutor - Password:
java_swing_tutor - Port:
5450(host) /5432(container)
For development, you can run the service outside Docker:
# Start only the database and migrations
docker compose up db flyway
# In another terminal, run the service locally
cd service
mvn spring-boot:runThis allows for faster iteration during development with hot-reload capabilities.
# Build the client
mvn clean package -pl desktop-client -am
# Run the client (connects to backend at http://localhost:8080)
java -jar desktop-client/target/desktop-client-<version>.jarjava-swing-tutor/
βββ domain/ # Shared DTOs and request models
β βββ src/main/java/
β βββ com/posadskiy/javaswingtutor/domain/
β βββ dto/ # Data Transfer Objects
β βββ request/ # API request models
β βββ response/ # API response models
β
βββ service/ # Spring Boot REST API backend
β βββ src/main/java/
β βββ com/posadskiy/javaswingtutor/service/
β βββ application/ # Application services
β βββ domain/ # Domain entities, mappers, and checkers
β βββ infrastructure/ # JPA repositories and external clients
β βββ web/ # REST controllers
β βββ src/main/resources/
β βββ application.yml # Spring Boot configuration
β
βββ flyway/ # Database migrations (separate from service)
β βββ src/main/resources/db/migration/
β βββ common/ # Schema and common data
β βββ lesson/ # Base lesson data
β βββ lesson_en/ # English translations
β βββ lesson_ru/ # Russian translations
β βββ lesson_es/ # Spanish translations
β βββ lesson_it/ # Italian translations
β
βββ desktop-client/ # Swing desktop UI client
β βββ src/main/java/
β βββ com/posadskiy/javaswingtutor/
β βββ api/ # REST API clients
β βββ application/ # Application services
β βββ domain/ # Domain models
β βββ infrastructure/ # Configuration, storage, compiler
β βββ presentation/ # UI components, controllers, views
β βββ src/main/resources/
β βββ i18n/ # Internationalization files
β
βββ deployment/ # Shared cluster config and scripts (see deployment/README.md)
βββ flyway/ # Migrations module + Flyway image and K8s Job (flyway/deployment/)
βββ website/ # Next.js website (and website/deployment/ for deploy)
βββ docker-compose.yml # Docker services configuration
βββ service/Dockerfile # Service container image (build context: repo root)
βββ pom.xml # Root Maven POM
The backend service exposes REST APIs at http://localhost:8080/api:
POST /api/auth/login- User authenticationPOST /api/auth/register- User registrationPOST /api/auth/refresh- Refresh authentication token
GET /api/users- List usersGET /api/users/{id}- Get user details
GET /api/lessons?categoryId={id}- Get lessons by categoryGET /api/tasks?lessonId={id}- Get tasks by lessonGET /api/keywords- Get programming keywords referenceGET /api/shorthands- Get code shorthands referenceGET /api/documentation/{id}- Get lesson documentationGET /api/errors/{id}- Get error details and explanations
GET /api/completed-tasks?userId={id}- Get user's completed tasksPOST /api/completed-tasks- Mark task as completed
POST /api/code/check- Validate user code against task requirements
The application uses PostgreSQL with Flyway for database migrations. All migrations are in the flyway module:
flyway/src/main/resources/db/migration/
The database schema includes:
- Users: User accounts and authentication
- Lessons: Learning content organized by categories
- Tasks: Individual programming exercises
- Completed Tasks: User progress tracking
- Documentation: Reference materials for lessons
- Translations: Multi-language support for content
# Build everything
mvn clean package
# Build specific module
mvn clean package -pl service
mvn clean package -pl desktop-clientmvn clean package -DskipTests=false- The desktop client connects to the backend via REST API by default
- Email verification for registration is optional (requires SMTP credentials)
- The backend service runs in Docker; the desktop client runs on your host machine
- All modules use Java 25 and Spring Boot 4.0.1
- Code formatting follows Google Java Format (enforced by Spotless)
- The application supports session restoration on restart
The project includes Docker support for easy deployment:
# Start all services
docker compose up --build
# Start in detached mode
docker compose up -d --build
# Stop services
docker compose down
# View logs
docker compose logs -f serviceFlow: deploy common cluster config from the parent deployment/, then build images and deploy from each
module (website, flyway, service). Flyway and service are separate: deploy Flyway first (migrations), then the backend
service. There is no central βbuild and push allβ; each module builds and pushes its own image, then deploys. See *
deployment/README.md* for layout and prerequisites.
# 1. Deploy common cluster config from parent (namespace, secret, ConfigMap, Secrets, Traefik IngressRoute + middleware)
./deployment/scripts/k3s/deploy-to-k3s.sh
# 2. Website (from website/)
cd website && ./deployment/scripts/build-and-push.sh <version> && ./deployment/scripts/deploy.sh <version>
# 3. Flyway migrations (from flyway/) β run before the backend service
cd flyway && ./deployment/scripts/build-and-push.sh <version> && ./deployment/scripts/deploy.sh <version>
# 4. Backend service (from service/)
cd service && ./deployment/scripts/build-and-push.sh <version> && ./deployment/scripts/deploy.sh <version>The application includes 50+ lessons covering:
- Basics: Introduction to Swing, windows, and components
- Layouts: Layout managers and component positioning
- Events: Event handling and user interactions
- Components: Buttons, text fields, menus, dialogs
- Advanced: Custom components, graphics, and animations
- Best Practices: Design patterns and Swing architecture
Each lesson contains multiple tasks with increasing difficulty, allowing learners to progress at their own pace.
This is an educational project. Contributions, suggestions, and improvements are welcome!
[Specify your license here]
Happy Learning! π Start your Java Swing journey today with Java Swing Tutor.