A desktop quiz application built with Java Swing that tests users on computer science topics. It features a database-backed login system, two quiz modes (35-question and full bank), randomized answer order, lifelines (50:50 and hint), timed questions, and a score summary screen.
- Architecture
- Project Structure
- Prerequisites
- Environment Setup
- Build and Run
- Configuration
- Screenshots
- Contributing
- License
- Author
The codebase follows a layered package layout under com.qaisr:
| Layer | Responsibility |
|---|---|
config |
Externalised database configuration via environment variables |
model |
Domain data classes (Question) |
ui |
Swing frames and panels (LoginFrame, QuizPanel, ScorePanel, TimerDisplay) |
service |
Quiz orchestration (QuizService for full bank, QuizShortService for 35-question mode) |
util |
Shared helpers (AnswerShuffler) |
See docs/ARCHITECTURE.md for a deeper walkthrough.
Desktop-app/
├── pom.xml
├── .editorconfig
├── .gitattributes
├── LICENSE
├── docs/
│ └── ARCHITECTURE.md
├── src/
│ └── main/
│ ├── java/
│ │ ├── module-info.java
│ │ └── com/qaisr/
│ │ ├── QuizApplication.java # Entry point
│ │ ├── config/
│ │ │ └── DatabaseConfig.java # DB connection constants
│ │ ├── model/
│ │ │ └── Question.java # Question data model
│ │ ├── ui/
│ │ │ ├── LoginFrame.java # Login screen (Swing JFrame)
│ │ │ ├── LoginFrame.form # NetBeans form descriptor
│ │ │ ├── QuizPanel.java # Question display panel
│ │ │ ├── ScorePanel.java # Score summary panel
│ │ │ └── TimerDisplay.java # Timer utility
│ │ ├── service/
│ │ │ ├── QuizService.java # Full quiz runner
│ │ │ └── QuizShortService.java # 35-question quiz runner
│ │ └── util/
│ │ └── AnswerShuffler.java # Answer randomisation
│ └── resources/
│ ├── application.properties
│ └── com/qaisr/
│ ├── ui/
│ │ ├── fifty-fifty.png # 50:50 lifeline icon
│ │ ├── hint.png # Hint lifeline icon
│ │ └── R.png # Logo / branding image
│ ├── primary.fxml
│ └── secondary.fxml
└── README.md
- Java JDK 11 or later
- Apache Maven 3.6+
- MySQL 5.7+ (or MariaDB equivalent)
Database credentials are read from environment variables so that nothing sensitive is committed to source control:
export QUIZ_DB_URL="jdbc:mysql://localhost:3306/nlogin?zeroDateTimeBehavior=CONVERT_TO_NULL"
export QUIZ_DB_USER="root"
export QUIZ_DB_PASSWORD=""If the variables are not set, the application falls back to the defaults shown above.
-
Clone the repository
git clone https://github.com/R-Alothaim/Desktop-app.git cd Desktop-app -
Build the project
mvn clean compile
-
Run the application
mvn javafx:run
Runtime configuration lives in src/main/resources/application.properties. Database connection parameters should be overridden via the environment variables described above rather than editing the file directly.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/my-feature). - Commit your changes and open a pull request.
Please follow the existing code style enforced by .editorconfig.
This project is available under the MIT License.
R-Alothaim -- GitHub