|
|
|
|
@ -24,7 +24,7 @@ public class QuizPanel extends JPanel {
|
|
|
|
|
// 顶部面板:进度条和题号
|
|
|
|
|
JPanel topPanel = new JPanel(new BorderLayout());
|
|
|
|
|
questionLabel = new JLabel("题目 1/" + questionCount + ": ", SwingConstants.LEFT);
|
|
|
|
|
questionLabel.setFont(new Font("思源黑体", Font.BOLD, 20));
|
|
|
|
|
questionLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
|
|
|
|
progressBar = new JProgressBar(0, questionCount);
|
|
|
|
|
progressBar.setValue(0);
|
|
|
|
|
progressBar.setStringPainted(true);
|
|
|
|
|
@ -38,7 +38,7 @@ public class QuizPanel extends JPanel {
|
|
|
|
|
optionButtons = new JRadioButton[4];
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
optionButtons[i] = new JRadioButton();
|
|
|
|
|
optionButtons[i].setFont(new Font("思源黑体", Font.PLAIN, 16));
|
|
|
|
|
optionButtons[i].setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
optionsGroup.add(optionButtons[i]);
|
|
|
|
|
centerPanel.add(optionButtons[i]);
|
|
|
|
|
centerPanel.add(Box.createVerticalStrut(10));
|
|
|
|
|
@ -67,7 +67,7 @@ public class QuizPanel extends JPanel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void displayQuestion(Question question, int currentQuestionIndex, int totalQuestions) {
|
|
|
|
|
questionLabel.setText(String.format("题目 %d/%d: %s", currentQuestionIndex + 1, totalQuestions, question.problemStatement()));
|
|
|
|
|
questionLabel.setText(String.format("题目 %d/%d: %s", currentQuestionIndex + 1, totalQuestions, question.problemStatement()));
|
|
|
|
|
progressBar.setValue(currentQuestionIndex);
|
|
|
|
|
java.util.List<String> options = question.options();
|
|
|
|
|
for (int i = 0; i < optionButtons.length; i++) {
|
|
|
|
|
|