├── .idea ├── .name ├── vcs.xml ├── .gitignore ├── misc.xml └── modules.xml ├── banner.png ├── .gitignore ├── java-test-platform.iml ├── README.md └── src └── Test.java /.idea/.name: -------------------------------------------------------------------------------- 1 | java-test-platform.iml -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Iqbolshoh/java-test-platform/main/banner.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### IntelliJ IDEA ### 2 | out/ 3 | !**/src/main/**/out/ 4 | !**/src/test/**/out/ 5 | 6 | ### Eclipse ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | bin/ 15 | !**/src/main/**/bin/ 16 | !**/src/test/**/bin/ 17 | 18 | ### NetBeans ### 19 | /nbproject/private/ 20 | /nbbuild/ 21 | /dist/ 22 | /nbdist/ 23 | /.nb-gradle/ 24 | 25 | ### VS Code ### 26 | .vscode/ 27 | 28 | ### Mac OS ### 29 | .DS_Store -------------------------------------------------------------------------------- /java-test-platform.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📚 Java Test Platform 2 | 3 | Welcome to **Java Test Platform**! 🚀 This is a simple but effective quiz application built with **Java Swing**. It provides an interactive way to test and enhance vocabulary skills with multiple-choice questions and a countdown timer. 4 | 5 | ## 📸 Preview 6 | ![App Screenshot](./banner.png) 7 | 8 | ## 🎯 Features 9 | - ⏳ **Timed Questions**: Each question has a 15-second timer. 10 | - 🎭 **Randomized Options**: Answer choices are shuffled for each question. 11 | - 🏆 **Scoring System**: Correct answers earn points. 12 | - 🔄 **Automatic Progression**: Moves to the next question automatically. 13 | - ✅ **Final Score Summary**: Displays correct, incorrect answers, and total score at the end. 14 | - 🎨 **User-Friendly Interface**: Simple and interactive GUI for better user experience. 15 | - 📊 **Performance Tracking**: Keeps track of the user's score throughout the test. 16 | - 🔁 **Replay Option**: Restart the test after completion. 17 | 18 | ## 🛠 Installation & Usage 19 | 1. **Clone the Repository** 20 | ```sh 21 | git clone https://github.com/Iqbolshoh/java-test-platform.git 22 | cd java-test-platform 23 | ``` 24 | 2. **Compile and Run the Application** 25 | - Open the project in your favorite **Java IDE** (IntelliJ, Eclipse, or NetBeans). 26 | - Compile and run `Test.java`. 27 | - Enjoy the quiz! 🎉 28 | 29 | ## 🖥 Technologies Used 30 |
31 | Java 32 | Swing 33 | AWT 34 |
35 | 36 | ## 📜 License 37 | This project is open-source and available under the **MIT License**. 38 | 39 | ## 🤝 Contributing 40 | 🎯 Contributions are welcome! If you have suggestions or want to enhance the project, feel free to fork the repository and submit a pull request. 41 | 42 | ## 📬 Connect with Me 43 | 💬 I love meeting new people and discussing tech, business, and creative ideas. Let’s connect! You can reach me on these platforms: 44 | 45 |
46 | 47 | 48 | 54 | 60 | 66 | 72 | 78 | 84 | 90 | 96 | 102 | 103 |
49 | 50 | Website 52 | 53 | 55 | 56 | Email 58 | 59 | 61 | 62 | GitHub 64 | 65 | 67 | 68 | LinkedIn 70 | 71 | 73 | 74 | Telegram 76 | 77 | 79 | 80 | WhatsApp 82 | 83 | 85 | 86 | Instagram 88 | 89 | 91 | 92 | X 94 | 95 | 97 | 98 | YouTube 100 | 101 |
104 |
105 | 106 | -------------------------------------------------------------------------------- /src/Test.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.awt.*; 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.util.Random; 6 | 7 | public class Test { 8 | private JFrame frame; 9 | private JPanel panel; 10 | private JLabel questionLabel, timerLabel, emojiLabel, statusLabel; 11 | private JRadioButton[] options; 12 | private JButton nextButton; 13 | private ButtonGroup group; 14 | private int currentQuestion = 0; 15 | private int correctAnswers = 0; 16 | private int incorrectAnswers = 0; 17 | private int score = 0; 18 | private Timer questionTimer; 19 | private int timeLeft = 15; 20 | 21 | // List of questions (words, translations, and emojis) 22 | private String[][] questions = { 23 | {"Drill", "burg'ulash", "🛠️"}, 24 | {"Preview", "ko'rib chiqish", "👀"}, 25 | {"Stand", "turish", "🚶"}, 26 | {"Impaired view", "ko'rish buzilgan", "👓"}, 27 | {"Long jump", "uzunlikka sakrash", "🏃‍♂️"}, 28 | {"Hurdle", "to'siq", "🏃‍♂️💨"}, 29 | {"Helmet", "dubulg'a", "⛑️"}, 30 | {"Skates", "konkilar", "⛸️"}, 31 | {"Glove", "qo'lqop", "🧤"}, 32 | {"Shoulder pad", "yelka yostig'i", "🏈"} 33 | }; 34 | 35 | public Test() { 36 | frame = new JFrame("Test App"); 37 | panel = new JPanel(); 38 | panel.setLayout(new BorderLayout()); 39 | 40 | // Top section (Question, Emoji, Status) 41 | JPanel topPanel = new JPanel(new GridLayout(3, 1)); 42 | statusLabel = new JLabel("", SwingConstants.CENTER); 43 | questionLabel = new JLabel("", SwingConstants.CENTER); 44 | emojiLabel = new JLabel("", SwingConstants.CENTER); 45 | timerLabel = new JLabel("", SwingConstants.CENTER); 46 | 47 | topPanel.add(statusLabel); 48 | topPanel.add(questionLabel); 49 | topPanel.add(emojiLabel); 50 | 51 | // Bottom section (Options and Button) 52 | JPanel bottomPanel = new JPanel(new GridLayout(4, 1)); 53 | options = new JRadioButton[3]; 54 | group = new ButtonGroup(); 55 | 56 | for (int i = 0; i < 3; i++) { 57 | options[i] = new JRadioButton(); 58 | group.add(options[i]); 59 | bottomPanel.add(options[i]); 60 | } 61 | 62 | nextButton = new JButton("Next Question ->"); 63 | nextButton.addActionListener(e -> nextQuestion()); 64 | bottomPanel.add(nextButton); 65 | 66 | panel.add(topPanel, BorderLayout.NORTH); 67 | panel.add(timerLabel, BorderLayout.CENTER); 68 | panel.add(bottomPanel, BorderLayout.SOUTH); 69 | 70 | frame.add(panel); 71 | frame.setSize(400, 350); 72 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 73 | frame.setVisible(true); 74 | 75 | startTimer(); 76 | loadQuestion(); 77 | } 78 | 79 | // Load the questions and generate random answer choices 80 | private void loadQuestion() { 81 | if (currentQuestion >= questions.length) { 82 | showResult(); 83 | return; 84 | } 85 | 86 | statusLabel.setText("Question: " + (currentQuestion + 1) + "/" + questions.length + " | Score: " + score); 87 | questionLabel.setText(questions[currentQuestion][0]); 88 | emojiLabel.setText(questions[currentQuestion][2]); 89 | timerLabel.setText("Time: " + timeLeft + " sec"); 90 | 91 | String[] variants = generateVariants(currentQuestion); 92 | for (int i = 0; i < 3; i++) { 93 | options[i].setText(variants[i]); 94 | options[i].setSelected(false); 95 | } 96 | 97 | timeLeft = 15; 98 | startTimer(); 99 | } 100 | 101 | // Generate random answer choices 102 | private String[] generateVariants(int questionIndex) { 103 | String[] variants = new String[3]; 104 | Random random = new Random(); 105 | 106 | variants[0] = questions[questionIndex][1]; // Correct answer 107 | for (int i = 1; i < 3; i++) { 108 | int randomIndex; 109 | do { 110 | randomIndex = random.nextInt(questions.length); 111 | } while (randomIndex == questionIndex); 112 | variants[i] = questions[randomIndex][1]; 113 | } 114 | 115 | // Shuffle the answer choices 116 | for (int i = 0; i < 3; i++) { 117 | int swapIndex = random.nextInt(3); 118 | String temp = variants[i]; 119 | variants[i] = variants[swapIndex]; 120 | variants[swapIndex] = temp; 121 | } 122 | 123 | return variants; 124 | } 125 | 126 | // Start the timer for each question 127 | private void startTimer() { 128 | if (questionTimer != null) { 129 | questionTimer.stop(); 130 | } 131 | questionTimer = new Timer(1000, e -> { 132 | timeLeft--; 133 | timerLabel.setText("Time: " + timeLeft + " sec"); 134 | if (timeLeft <= 0) { 135 | questionTimer.stop(); 136 | nextQuestion(); 137 | } 138 | }); 139 | questionTimer.start(); 140 | } 141 | 142 | // Move to the next question 143 | private void nextQuestion() { 144 | checkAnswer(); 145 | currentQuestion++; 146 | group.clearSelection(); 147 | loadQuestion(); 148 | } 149 | 150 | // Check the selected answer 151 | private void checkAnswer() { 152 | for (JRadioButton option : options) { 153 | if (option.isSelected()) { 154 | if (option.getText().equals(questions[currentQuestion][1])) { 155 | correctAnswers++; 156 | score += 10; 157 | } else { 158 | incorrectAnswers++; 159 | } 160 | break; 161 | } 162 | } 163 | } 164 | 165 | // Show the final result 166 | private void showResult() { 167 | questionTimer.stop(); 168 | JOptionPane.showMessageDialog(frame, "Test Completed!\nCorrect Answers: " + correctAnswers + "\nIncorrect Answers: " + incorrectAnswers + "\nTotal Score: " + score); 169 | System.exit(0); 170 | } 171 | 172 | public static void main(String[] args) { 173 | new Test(); 174 | } 175 | } --------------------------------------------------------------------------------