Skip to content

Java Swing WPM typing test with live stats, error highlighting, history, and JFreeChart visualizations.

Notifications You must be signed in to change notification settings

SatishGautam1/Typing-Test

Repository files navigation

Typing Test (Java Swing)

A modern Words Per Minute (WPM) typing test desktop application built with Java (Swing). Tracks live WPM and accuracy, highlights mistakes, saves session history, and visualizes performance with charts. Passages can be loaded from an external file so each session can use long, varied text.


Features

  • Live WPM and accuracy updating in real time
  • Error highlighting with correct characters in green and mistakes in red
  • Countdown timer default 60 seconds, configurable in code or UI
  • Session history saved to results.csv with timestamp, WPM, accuracy, and errors
  • View history table and performance charts using JFreeChart
  • External passages loaded from passages.txt in classpath or working directory
  • Input placeholder that appears when the input is empty

Prerequisites

  • Java 17 or newer installed and JAVA_HOME set
  • IntelliJ IDEA Community or Ultimate recommended
  • Gradle optional — the project can use the Gradle wrapper
  • Add these dependencies to build.gradle if not present:
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation 'org.jfree:jfreechart:1.5.4'      // charts
        implementation 'com.formdev:flatlaf:2.6'         // optional modern look and feel
    }

Getting Started

1. Clone the repository

git clone https://github.com/SatishGautam1/Typing-Test.git
cd Typing-Test

2. Open in IntelliJ IDEA

  • Launch IntelliJ IDEA.
  • Go to File → Open... and select the project root folder (Typing-Test).
  • IntelliJ will detect the Gradle build file (build.gradle) and import dependencies automatically.
  • Ensure the Project SDK is set to Java 17 or newer: File → Project Structure → Project → Project SDK → select JDK 17+.

3. Build the project

  • From IntelliJ: Build → Build Project.
  • From command line (Gradle wrapper):
./gradlew clean build

4. Run the project

  • In IntelliJ: Open com.nighttech.typingtest.ui.TypingTestApp.
  • Click the green Run icon next to the main method.
  • From command line:
./gradlew run

Or run the JAR directly:

java -jar build/libs/typing-test-1.0.0-all.jar

Project Structure

Typing-Test/
├─ build.gradle
├─ settings.gradle
├─ src/
│  ├─ main/
│  │  ├─ java/com/nighttech/typingtest/
│  │  │  ├─ model/        # SessionState, ResultRecord
│  │  │  ├─ service/      # TypingSessionService, HistoryRepository
│  │  │  ├─ ui/           # TypingTestApp (Swing UI)
│  │  │  └─ util/         # StatsCalculator
│  │  └─ resources/
│  │     └─ passages.txt  # optional resource file with passages
└─ README.md

Passages File

  • Place passages.txt in src/main/resources/ or in the working directory.
  • Separate passages with blank lines. Example:
The quick brown fox jumps over the lazy dog.
    
Here is a longer passage that spans multiple sentences and is intended for practice.
    
Another passage for variety.

Troubleshooting

  • passages.txt not found → Ensure the file is in src/main/resources/ or the working directory.
  • Empty passages list → Passages must be separated by blank lines.
  • Dependencies not resolved → Re-import Gradle project in IntelliJ (View → Tool Windows → Gradle → Refresh).
  • Charts not displaying → Confirm org.jfree:jfreechart is on the classpath.
  • Placeholder not visible → Ensure you are running the latest build; placeholder appears when input is empty.

License

MIT License — feel free to use, modify, and share.

About

Java Swing WPM typing test with live stats, error highlighting, history, and JFreeChart visualizations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages