A modern, interactive quiz application built with Java Swing that tests your knowledge with a variety of questions. The application features a sleek, user-friendly interface with smooth animations and sound effects.
- Modern UI Design: Clean and intuitive interface with smooth animations
- Dark/Light Mode: Toggle between dark and light themes
- Sound Effects: Interactive sound feedback with toggle option
- Practice Mode: Learn at your own pace without time pressure
- Progress Tracking: Visual progress bar and score display
- Answer Review: Detailed review of all questions after completion
- High Score Tracking: Keep track of your best performance
- Responsive Design: Smooth animations and transitions
- Accessibility: Clear contrast and readable text
- Database Integration: Questions stored in MySQL database
- Launch the application
- Click "START QUIZ" to begin
- Read each question carefully
- Select your answer from the options provided
- Click "Submit" or wait for the timer
- Review your answers at the end
- Try again to improve your score!
- Database Integration: MySQL database for question storage
- Object-Oriented Design: Clean code structure with separate classes
- Event Handling: Smooth user interaction handling
- Custom Styling: Modern UI components with gradients
- Sound System: Interactive sound effects for feedback
- Theme System: Dynamic theme switching
- Progress Tracking: Real-time score and progress updates
- Java Development Kit (JDK) 8 or higher
- MySQL Server (Version 8.0 or higher recommended)
- MySQL Connector/J (JDBC Driver)
- Java IDE (e.g., IntelliJ IDEA, Eclipse)
- Download MySQL Community Server from MySQL Official Website
- Run the installer and follow the setup wizard
- Remember to note down your root password
- Download XAMPP from Apache Friends
- Install XAMPP which includes MySQL
- Start MySQL from XAMPP Control Panel
- MySQL Workbench: Official GUI tool for MySQL
- Download from MySQL Workbench
- Great for database management and query execution
- phpMyAdmin: Web-based MySQL administration tool
- Included with XAMPP
- User-friendly interface for database management
- HeidiSQL: Lightweight alternative
- Download from HeidiSQL
- Simple and fast database management
- Open your preferred MySQL tool (MySQL Workbench, phpMyAdmin, or HeidiSQL)
- Create a new database and tables using the provided SQL script:
CREATE DATABASE quiz_app;
USE quiz_app;
-- Create questions table
CREATE TABLE questions (
id INT PRIMARY KEY AUTO_INCREMENT,
question TEXT NOT NULL,
option1 VARCHAR(255),
option2 VARCHAR(255),
option3 VARCHAR(255),
option4 VARCHAR(255),
correct_answer VARCHAR(255) NOT NULL
);
-- Insert sample questions
INSERT INTO questions (question, option1, option2, option3, option4, correct_answer) VALUES
('What is 2 + 2?', '3', '4', '5', '6', '4'),
('What is the capital of France?', 'London', 'Berlin', 'Paris', 'Madrid', 'Paris'),
('Which is a programming language?', 'HTML', 'CSS', 'Java', 'HTTP', 'Java'),
('What does CPU stand for?', 'Central Processing Unit', 'Computer Personal Unit', 'Central Program Unit', 'Computer Processing Unit', 'Central Processing Unit'),
('Which is the largest planet?', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Jupiter');
- Clone the repository
- Download MySQL Connector/J:
- Visit MySQL Connector/J Downloads
- Download the Platform Independent (ZIP) version
- Extract the ZIP file
- Add the
mysql-connector-j-*.jar
file to your project's classpath
- Update database credentials in
DatabaseConnector.java
:
private static final String URL = "jdbc:mysql://localhost:3306/quiz_app";
private static final String USER = "your_username";
private static final String PASSWORD = "your_password";
# Compile
javac -cp ".;mysql-connector-j-*.jar" *.java
# Run
java -cp ".;mysql-connector-j-*.jar" QuizApp
# Compile
javac -cp ".:mysql-connector-j-*.jar" *.java
# Run
java -cp ".:mysql-connector-j-*.jar" QuizApp
- Open the project in IntelliJ IDEA
- Right-click on the project folder
- Select "Add Framework Support"
- Choose "Maven" or "Gradle"
- Add the following dependency to your
pom.xml
(Maven) orbuild.gradle
(Gradle):
Maven (pom.xml
):
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
Gradle (build.gradle
):
dependencies {
implementation 'mysql:mysql-connector-java:8.0.33'
}
- Open the project in Eclipse
- Right-click on the project
- Select "Build Path" → "Configure Build Path"
- Click on "Libraries" tab
- Click "Add External JARs"
- Select the downloaded MySQL Connector JAR file
-
Classpath Issues
- Make sure the MySQL Connector JAR is in the correct location
- Verify the classpath separator (use
;
for Windows,:
for Linux/Mac) - Check for spaces in file paths
-
Version Compatibility
- Ensure Java version matches the project requirements (JDK 8 or higher)
- Verify MySQL Connector version compatibility
-
Common Errors
- "Class not found": Check classpath and JAR file location
- "Package not found": Verify import statements
- "Access denied": Check database credentials
-
Database Connection
- Verify MySQL server is running
- Check database credentials in
DatabaseConnector.java
- Ensure database and tables are created
# 1. Download MySQL Connector
# 2. Place it in the project directory
# 3. Compile
javac -cp ".;mysql-connector-j-*.jar" *.java
# 4. Run
java -cp ".;mysql-connector-j-*.jar" QuizApp
# 1. Download MySQL Connector
# 2. Place it in the project directory
# 3. Compile
javac -cp ".:mysql-connector-j-*.jar" *.java
# 4. Run
java -cp ".:mysql-connector-j-*.jar" QuizApp
Note: Replace mysql-connector-j-*.jar
with the actual filename of your downloaded connector (e.g., mysql-connector-j-8.0.33.jar
).
- Welcome Screen: Modern landing page with start button
- Quiz Interface: Clean question display with options
- Progress Bar: Visual progress indicator
- Score Display: Real-time score tracking
- Review Panel: Detailed answer review
- Theme Toggle: Dark/Light mode switch
- Sound Toggle: Enable/disable sound effects
The application can be configured through:
DatabaseConnector.java
: Database settingsQuizGUI.java
: UI customizationQuestion.java
: Question structure
- Timed Mode: Answer questions within the time limit
- Practice Mode: Learn at your own pace
- Review Mode: Study your answers after completion
- Colors: Modern color scheme with gradients
- Fonts: Clean, readable typography
- Animations: Smooth transitions and effects
- Sound: Interactive audio feedback
- Themes: Dark and light mode support
- Added sound toggle functionality with confirmation dialog
- Enhanced button hover effects
- Added tooltips for better user guidance
- Improved sound system with different feedback types
- Enhanced UI responsiveness
- Added confirmation dialog for sound toggle
- Improved button feedback and accessibility
- Updated scoring system to only count answered questions
- Added unanswered questions counter in results
- Multiple question categories
- Difficulty levels
- User profiles and statistics
- Online multiplayer mode
- Custom question creation
- Achievement system
- Leaderboard integration
- Mobile app version
- More sound options and customization
- Enhanced animations and transitions
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For any questions or suggestions, please open an issue in the repository.
-
Connection Refused
- Check if MySQL server is running
- Verify port number (default: 3306)
- Check firewall settings
-
Access Denied
- Verify username and password
- Check user privileges
- Reset root password if needed
-
Driver Not Found
- Ensure MySQL Connector/J is in classpath
- Check JAR file version compatibility
- Verify build path settings in IDE
-
Compilation Errors
- Verify JDK installation
- Check classpath settings
- Ensure all required files are present
-
Runtime Errors
- Check database connection settings
- Verify MySQL server status
- Check application logs