• Typing Test Application – Boost Your Typing Skills!



    šŸŽÆ Project Overview

    I’m excited to share my latest project — Typing Test Application, a desktop-based Java GUI project designed to help users practice and improve their typing speed and accuracy. Whether you're preparing for a job test, improving your typing skills, or just having fun, this tool is for you.

    This app is fully developed using Java Swing, featuring a clean and interactive interface that calculates your Words Per Minute (WPM), accuracy, and typing time in real-time.


    šŸ’” Key Features

    Sensor-Free, Simple & Functional
    Random Paragraph Generator — Provides a new paragraph each time for diverse practice.
    Real-Time Statistics — Displays Timer, Accuracy, and WPM as you type.
    Overflow Alert — Automatically stops when paragraph is fully typed.
    Previous Results Panel — Stores your last test results for comparison.
    User-Friendly UI — Modern dark theme with rounded buttons and responsive layout.
    Restart Option — Restart anytime with one click.





    šŸ’» Source Code – Typing Test Application in Java

    java
    import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; public class TypingTester extends JFrame implements ActionListener { private JTextArea paragraphArea, inputArea; private JButton startButton, resetButton; private JLabel timerLabel, accuracyLabel, wpmLabel, resultsLabel; private String[] paragraphs = { "Time world people day way year man thing woman life child school.", "Look work feel try leave call good new first last long great.", "Little work place hand part case week system world people day way.", "Life time day year work word way look hand part place case week.", "Good new first last long great small right big high early best own." }; private String currentParagraph; private long startTime; private boolean testStarted = false; private String lastTime = "", lastAccuracy = "", lastWPM = ""; public TypingTester() { setTitle("Typing Test Application"); setSize(950, 650); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setLayout(new BorderLayout(10, 10)); getContentPane().setBackground(new Color(30, 30, 30)); paragraphArea = new JTextArea(); paragraphArea.setEditable(false); paragraphArea.setLineWrap(true); paragraphArea.setWrapStyleWord(true); paragraphArea.setFont(new Font("Consolas", Font.BOLD, 18)); paragraphArea.setForeground(Color.WHITE); paragraphArea.setBackground(new Color(45, 45, 45)); JScrollPane paragraphScroll = new JScrollPane(paragraphArea); paragraphScroll.setPreferredSize(new Dimension(900, 120)); add(paragraphScroll, BorderLayout.NORTH); inputArea = new JTextArea(10, 20); inputArea.setLineWrap(true); inputArea.setWrapStyleWord(true); inputArea.setFont(new Font("Consolas", Font.PLAIN, 18)); inputArea.setForeground(Color.GRAY); inputArea.setBackground(new Color(50, 50, 50)); inputArea.setEnabled(false); JScrollPane inputScroll = new JScrollPane(inputArea); add(inputScroll, BorderLayout.CENTER); JPanel controlPanel = new JPanel(new GridLayout(2, 1, 10, 10)); controlPanel.setBackground(new Color(30, 30, 30)); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(new Color(30, 30, 30)); startButton = new JButton("Start"); resetButton = new JButton("Restart"); startButton.addActionListener(this); resetButton.addActionListener(this); buttonPanel.add(startButton); buttonPanel.add(resetButton); JPanel statusPanel = new JPanel(); statusPanel.setBackground(new Color(30, 30, 30)); timerLabel = new JLabel("Time: 0s"); accuracyLabel = new JLabel("Accuracy: 0%"); wpmLabel = new JLabel("WPM: 0"); timerLabel.setForeground(Color.CYAN); accuracyLabel.setForeground(Color.GREEN); wpmLabel.setForeground(Color.PINK); statusPanel.add(timerLabel); statusPanel.add(accuracyLabel); statusPanel.add(wpmLabel); controlPanel.add(buttonPanel); controlPanel.add(statusPanel); add(controlPanel, BorderLayout.SOUTH); resultsLabel = new JLabel(); resultsLabel.setForeground(Color.YELLOW); add(resultsLabel, BorderLayout.EAST); inputArea.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (!testStarted) return; if (inputArea.getText().length() >= currentParagraph.length()) { endTest(); } else { updateStats(); } } }); setRandomParagraph(); } private void setRandomParagraph() { Random rand = new Random(); currentParagraph = paragraphs[rand.nextInt(paragraphs.length)]; paragraphArea.setText(currentParagraph); } private void updateStats() { String typed = inputArea.getText().replaceAll("\n", "").trim(); long elapsed = (System.currentTimeMillis() - startTime) / 1000; if (elapsed == 0) elapsed = 1; int correct = 0; for (int i = 0; i < Math.min(typed.length(), currentParagraph.length()); i++) { if (typed.charAt(i) == currentParagraph.charAt(i)) correct++; } double accuracy = (typed.length() == 0) ? 0 : (correct * 100.0 / typed.length()); int words = typed.isEmpty() ? 0 : typed.split("\\s+").length; int wpm = (int) ((words * 60.0) / elapsed); timerLabel.setText("Time: " + elapsed + "s"); accuracyLabel.setText(String.format("Accuracy: %.2f%%", accuracy)); wpmLabel.setText("WPM: " + wpm); } private void endTest() { testStarted = false; inputArea.setEnabled(false); updateStats(); lastTime = timerLabel.getText(); lastAccuracy = accuracyLabel.getText(); lastWPM = wpmLabel.getText(); JOptionPane.showMessageDialog(this, "Test completed!\n" + lastTime + "\n" + lastAccuracy + "\n" + lastWPM); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == startButton) { inputArea.setEnabled(true); inputArea.setText(""); inputArea.requestFocus(); setRandomParagraph(); timerLabel.setText("Time: 0s"); accuracyLabel.setText("Accuracy: 0%"); wpmLabel.setText("WPM: 0"); testStarted = true; startTime = System.currentTimeMillis(); } else if (e.getSource() == resetButton) { testStarted = false; inputArea.setEnabled(false); inputArea.setText(""); timerLabel.setText("Time: 0s"); accuracyLabel.setText("Accuracy: 0%"); wpmLabel.setText("WPM: 0"); setRandomParagraph(); } } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { TypingTester tester = new TypingTester(); tester.setVisible(true); }); } }

    🧠 How to Run This Code

    1. Copy the code above into a file named TypingTester.java.

    2. Open your Java IDE (IntelliJ, Eclipse, NetBeans) or use an online compiler like JDoodle, Replit, or OnlineGDB.

    3. Compile the file and run it.

    4. Enjoy your typing practice with real-time feedback!


    šŸš€ What’s Next?

    ✔ Add countdown timer modes (1 min, 2 min)
    ✔ Allow users to upload their own text files for typing practice
    ✔ Save session history to a file
    ✔ Add sound effects and themes for a more interactive experience


    šŸ’¬ Feedback & Suggestions

    I'd love to hear your thoughts! Feel free to leave comments, suggestions, or ideas to improve this application. šŸ’”

  • 0 Comments:

    Post a Comment

    GET A FREE QUOTE NOW

    Have questions about fees or need personalized assistance? Feel free to visit my LinkedIn profile for more details and inquiries!

    Powered by Blogger.
    ADDRESS

    CB-1279, Street no 8, Chour Chowk, Rawalpindi, Pakistan

    EMAIL

    adnanxn34101@gmail.com

    MOBILE PHONE

    +92346-802913-8
    +92317-052974-0