界面修改

pull/5/head
杨默涵 2 months ago
parent 9d17e676fd
commit 9d7116793b

@ -1,8 +1,11 @@
package com.example.mathsystemtogether; package com.example.mathsystemtogether;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -28,29 +31,6 @@ public class ExamController {
@FXML private Button logoutButton; @FXML private Button logoutButton;
@FXML private Label statusLabel; @FXML private Label statusLabel;
// 考试界面控件
@FXML private VBox examPanel;
@FXML private Label questionNumberLabel;
@FXML private Label questionTextLabel;
@FXML private RadioButton optionA;
@FXML private RadioButton optionB;
@FXML private RadioButton optionC;
@FXML private RadioButton optionD;
@FXML private ToggleGroup answerGroup;
@FXML private Button submitButton;
@FXML private Button nextButton;
@FXML private Label progressLabel;
@FXML private Button exitExamButton;
// 结果界面控件
@FXML private VBox resultPanel;
@FXML private Label resultTitleLabel;
@FXML private Label scoreLabel;
@FXML private Label correctCountLabel;
@FXML private Label totalCountLabel;
@FXML private TextArea resultDetailsArea;
@FXML private Button restartButton;
@FXML private Button backToLoginButton;
// 数据成员 // 数据成员
private Account currentAccount; private Account currentAccount;
@ -68,10 +48,7 @@ public class ExamController {
public void initialize() { public void initialize() {
initAccounts(); initAccounts();
setupLevelComboBox(); setupLevelComboBox();
setupAnswerGroup();
examSetupPanel.setVisible(false); examSetupPanel.setVisible(false);
examPanel.setVisible(false);
resultPanel.setVisible(false);
questionCountField.setText("10"); questionCountField.setText("10");
} }
@ -96,13 +73,6 @@ public class ExamController {
levelComboBox.setValue("小学"); levelComboBox.setValue("小学");
} }
private void setupAnswerGroup() {
answerGroup = new ToggleGroup();
optionA.setToggleGroup(answerGroup);
optionB.setToggleGroup(answerGroup);
optionC.setToggleGroup(answerGroup);
optionD.setToggleGroup(answerGroup);
}
@FXML @FXML
private void handleLogin() { private void handleLogin() {
@ -136,8 +106,6 @@ public class ExamController {
currentQuestionIndex = 0; currentQuestionIndex = 0;
userAnswers.clear(); userAnswers.clear();
examSetupPanel.setVisible(false); examSetupPanel.setVisible(false);
examPanel.setVisible(false);
resultPanel.setVisible(false);
usernameField.clear(); usernameField.clear();
passwordField.clear(); passwordField.clear();
loginStatusLabel.setText(""); loginStatusLabel.setText("");
@ -184,137 +152,32 @@ public class ExamController {
} }
private void startExam() { private void startExam() {
currentQuestionIndex = 0; try {
userAnswers.clear(); // 打开专门的考试界面
examSetupPanel.setVisible(false); FXMLLoader loader = new FXMLLoader(getClass().getResource("exam-taking-view.fxml"));
examPanel.setVisible(true); Scene scene = new Scene(loader.load(), 1000, 950);
resultPanel.setVisible(false); Stage examStage = new Stage();
displayCurrentQuestion(); examStage.setTitle("数学考试 - " + currentAccount.username);
} examStage.setScene(scene);
examStage.setResizable(false);
private void displayCurrentQuestion() {
if (currentQuestionIndex >= examQuestions.size()) {
showResults();
return;
}
Question question = examQuestions.get(currentQuestionIndex);
questionNumberLabel.setText("第 " + (currentQuestionIndex + 1) + " 题 / 共 " + examQuestions.size() + " 题");
questionTextLabel.setText(question.getQuestionText());
optionA.setText("A. " + question.getOptionA());
optionB.setText("B. " + question.getOptionB());
optionC.setText("C. " + question.getOptionC());
optionD.setText("D. " + question.getOptionD());
// 清除之前的选择
answerGroup.selectToggle(null);
// 更新按钮状态
if (currentQuestionIndex == examQuestions.size() - 1) {
submitButton.setText("提交并完成考试");
nextButton.setVisible(false);
} else {
submitButton.setText("提交答案");
nextButton.setVisible(true);
}
progressLabel.setText("进度: " + (currentQuestionIndex + 1) + "/" + examQuestions.size());
}
@FXML
private void handleSubmitAnswer() {
RadioButton selectedOption = (RadioButton) answerGroup.getSelectedToggle();
if (selectedOption == null) {
statusLabel.setText("请选择一个答案");
statusLabel.setStyle("-fx-text-fill: red;");
return;
}
String answer = selectedOption.getText().substring(0, 1); // 获取A、B、C、D
userAnswers.put(currentQuestionIndex, answer);
if (currentQuestionIndex == examQuestions.size() - 1) {
// 最后一题,显示结果
showResults();
} else {
// 下一题
currentQuestionIndex++;
displayCurrentQuestion();
}
}
@FXML
private void handleNextQuestion() {
currentQuestionIndex++;
displayCurrentQuestion();
}
@FXML
private void handleExitExam() {
if (showExitConfirmation()) {
examPanel.setVisible(false);
examSetupPanel.setVisible(true);
currentQuestionIndex = 0;
userAnswers.clear();
}
}
private boolean showExitConfirmation() {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("确认退出");
alert.setHeaderText("确定要退出考试吗?");
alert.setContentText("退出后当前进度将丢失。");
return alert.showAndWait().orElse(ButtonType.CANCEL) == ButtonType.OK;
}
private void showResults() {
examPanel.setVisible(false);
resultPanel.setVisible(true);
int correctCount = 0;
StringBuilder resultDetails = new StringBuilder();
for (int i = 0; i < examQuestions.size(); i++) {
Question question = examQuestions.get(i);
String userAnswer = userAnswers.get(i);
boolean isCorrect = question.isCorrect(userAnswer);
if (isCorrect) { // 设置考试数据
correctCount++; ExamTakingController examController = loader.getController();
} examController.setExamData(examQuestions, currentAccount.username, levelComboBox.getValue());
resultDetails.append("第").append(i + 1).append("题: "); // 显示考试窗口
resultDetails.append(question.getQuestionText()).append("\n"); examStage.show();
resultDetails.append("你的答案: ").append(userAnswer != null ? userAnswer : "未作答").append(" ");
resultDetails.append("正确答案: ").append(question.getCorrectAnswer()).append(" "); // 隐藏主窗口
resultDetails.append(isCorrect ? "✓" : "✗").append("\n\n"); Stage mainStage = (Stage) startExamButton.getScene().getWindow();
mainStage.hide();
} catch (Exception e) {
statusLabel.setText("启动考试失败:" + e.getMessage());
statusLabel.setStyle("-fx-text-fill: red;");
} }
int score = (int) Math.round((double) correctCount / examQuestions.size() * 100);
resultTitleLabel.setText("考试完成!");
scoreLabel.setText("得分: " + score + "分");
correctCountLabel.setText("正确: " + correctCount + "题");
totalCountLabel.setText("总计: " + examQuestions.size() + "题");
resultDetailsArea.setText(resultDetails.toString());
} }
@FXML
private void handleRestart() {
resultPanel.setVisible(false);
examSetupPanel.setVisible(true);
currentQuestionIndex = 0;
userAnswers.clear();
}
@FXML
private void handleBackToLogin() {
resultPanel.setVisible(false);
examSetupPanel.setVisible(false);
examPanel.setVisible(false);
handleLogout();
}
// 内部类 // 内部类
static class Account { static class Account {

@ -0,0 +1,257 @@
package com.example.mathsystemtogether;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.util.Duration;
import java.util.*;
/**
*
*/
public class ExamTakingController {
// 界面控件
@FXML private Label examInfoLabel;
@FXML private Label questionNumberLabel;
@FXML private Label timeLabel;
@FXML private Label questionTextLabel;
@FXML private RadioButton optionA;
@FXML private RadioButton optionB;
@FXML private RadioButton optionC;
@FXML private RadioButton optionD;
@FXML private ToggleGroup answerGroup;
@FXML private Button submitButton;
@FXML private Button nextButton;
@FXML private Button exitExamButton;
@FXML private ProgressBar progressBar;
@FXML private Label progressLabel;
// 数据成员
private List<Question> examQuestions;
private int currentQuestionIndex = 0;
private Map<Integer, String> userAnswers = new HashMap<>();
private ChoiceQuestionGenerator questionGenerator;
private String username;
private String level;
private int totalQuestions;
private Timeline timer;
private int remainingSeconds;
@FXML
public void initialize() {
setupAnswerGroup();
setupTimer();
}
private void setupAnswerGroup() {
answerGroup = new ToggleGroup();
optionA.setToggleGroup(answerGroup);
optionB.setToggleGroup(answerGroup);
optionC.setToggleGroup(answerGroup);
optionD.setToggleGroup(answerGroup);
}
private void setupTimer() {
// 设置30分钟倒计时
remainingSeconds = 30 * 60; // 30分钟 = 1800秒
timer = new Timeline(new KeyFrame(Duration.seconds(1), e -> updateTimer()));
timer.setCycleCount(Timeline.INDEFINITE);
timer.play();
}
private void updateTimer() {
remainingSeconds--;
if (remainingSeconds <= 0) {
timer.stop();
handleTimeUp();
return;
}
int minutes = remainingSeconds / 60;
int seconds = remainingSeconds % 60;
timeLabel.setText(String.format("⏰ 剩余时间: %02d:%02d", minutes, seconds));
}
private void handleTimeUp() {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("时间到");
alert.setHeaderText("考试时间已到!");
alert.setContentText("系统将自动提交您的答案。");
alert.showAndWait();
showResults();
}
public void setExamData(List<Question> questions, String username, String level) {
this.examQuestions = questions;
this.username = username;
this.level = level;
this.totalQuestions = questions.size();
examInfoLabel.setText(String.format("👤 %s | 📚 %s | 📝 %d题", username, level, totalQuestions));
displayCurrentQuestion();
updateProgress();
}
private void displayCurrentQuestion() {
if (currentQuestionIndex >= examQuestions.size()) {
showResults();
return;
}
Question question = examQuestions.get(currentQuestionIndex);
questionNumberLabel.setText(String.format("第 %d 题 / 共 %d 题",
currentQuestionIndex + 1, examQuestions.size()));
questionTextLabel.setText(question.getQuestionText());
optionA.setText("A. " + question.getOptionA());
optionB.setText("B. " + question.getOptionB());
optionC.setText("C. " + question.getOptionC());
optionD.setText("D. " + question.getOptionD());
// 清除之前的选择
answerGroup.selectToggle(null);
// 更新按钮状态
if (currentQuestionIndex == examQuestions.size() - 1) {
submitButton.setText("✅ 提交并完成考试");
nextButton.setVisible(false);
} else {
submitButton.setText("✅ 提交答案");
nextButton.setVisible(true);
}
updateProgress();
}
private void updateProgress() {
double progress = (double) currentQuestionIndex / examQuestions.size();
progressBar.setProgress(progress);
progressLabel.setText(String.format("进度: %d/%d (%.1f%%)",
currentQuestionIndex + 1, examQuestions.size(), progress * 100));
}
@FXML
private void handleSubmitAnswer() {
RadioButton selectedOption = (RadioButton) answerGroup.getSelectedToggle();
if (selectedOption == null) {
showAlert("请选择一个答案", "请先选择答案再提交");
return;
}
String answer = selectedOption.getText().substring(0, 1); // 获取A、B、C、D
userAnswers.put(currentQuestionIndex, answer);
if (currentQuestionIndex == examQuestions.size() - 1) {
// 最后一题,显示结果
timer.stop();
showResults();
} else {
// 下一题
currentQuestionIndex++;
displayCurrentQuestion();
}
}
@FXML
private void handleNextQuestion() {
currentQuestionIndex++;
displayCurrentQuestion();
}
@FXML
private void handleExitExam() {
if (showExitConfirmation()) {
timer.stop();
returnToMainMenu();
}
}
private boolean showExitConfirmation() {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("确认退出");
alert.setHeaderText("确定要退出考试吗?");
alert.setContentText("退出后当前进度将丢失。");
return alert.showAndWait().orElse(ButtonType.CANCEL) == ButtonType.OK;
}
private void showAlert(String title, String message) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(message);
alert.showAndWait();
}
private void showResults() {
try {
// 停止计时器
timer.stop();
// 计算成绩
int correctCount = 0;
StringBuilder resultDetails = new StringBuilder();
for (int i = 0; i < examQuestions.size(); i++) {
Question question = examQuestions.get(i);
String userAnswer = userAnswers.get(i);
boolean isCorrect = question.isCorrect(userAnswer);
if (isCorrect) {
correctCount++;
}
resultDetails.append("第").append(i + 1).append("题: ");
resultDetails.append(question.getQuestionText()).append("\n");
resultDetails.append("你的答案: ").append(userAnswer != null ? userAnswer : "未作答").append(" ");
resultDetails.append("正确答案: ").append(question.getCorrectAnswer()).append(" ");
resultDetails.append(isCorrect ? "✓" : "✗").append("\n\n");
}
int score = (int) Math.round((double) correctCount / examQuestions.size() * 100);
// 显示结果对话框
Alert resultAlert = new Alert(Alert.AlertType.INFORMATION);
resultAlert.setTitle("考试完成");
resultAlert.setHeaderText("🎉 考试结果");
resultAlert.setContentText(String.format(
"得分: %d分\n正确: %d题\n总计: %d题\n正确率: %.1f%%",
score, correctCount, examQuestions.size(), (double) correctCount / examQuestions.size() * 100
));
resultAlert.showAndWait();
// 返回主菜单
returnToMainMenu();
} catch (Exception e) {
showAlert("错误", "显示结果时出错:" + e.getMessage());
}
}
private void returnToMainMenu() {
try {
// 关闭当前窗口
Stage currentStage = (Stage) submitButton.getScene().getWindow();
currentStage.close();
// 打开主菜单
FXMLLoader loader = new FXMLLoader(getClass().getResource("exam-view.fxml"));
Scene scene = new Scene(loader.load(), 1000, 900);
Stage stage = new Stage();
stage.setTitle("数学考试系统");
stage.setScene(scene);
stage.show();
} catch (Exception e) {
showAlert("错误", "返回主菜单时出错:" + e.getMessage());
}
}
}

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.mathsystemtogether.ExamTakingController" style="-fx-background-color: linear-gradient(to bottom, #6A0DAD, #4B0082, #2E0854);">
<top>
<VBox spacing="15.0" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC, #8B008B); -fx-background-radius: 15; -fx-padding: 20;">
<padding>
<Insets bottom="15.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label text="🎓 数学考试进行中" textFill="white" textAlignment="CENTER" style="-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.5), 10, 0, 0, 2);">
<font>
<Font name="System Bold" size="24.0"/>
</font>
</Label>
<Label fx:id="examInfoLabel" text="考试信息" textFill="#E6E6FA" textAlignment="CENTER">
<font>
<Font name="System" size="14.0"/>
</font>
</Label>
</VBox>
</top>
<center>
<VBox spacing="20.0" style="-fx-padding: 20;">
<!-- 题目信息区域 -->
<HBox spacing="20.0" alignment="CENTER" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC); -fx-background-radius: 20; -fx-padding: 15; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 8, 0, 0, 3);">
<Label fx:id="questionNumberLabel" text="第 1 题 / 共 10 题" textFill="white" textAlignment="CENTER">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<Label fx:id="timeLabel" text="⏰ 剩余时间: 30:00" textFill="white" textAlignment="CENTER">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
</HBox>
<!-- 题目显示区域 -->
<VBox spacing="20.0" style="-fx-background-color: linear-gradient(to bottom, #F0E6FF, #E6E6FA, #DDA0DD); -fx-padding: 30; -fx-background-radius: 20; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.3), 15, 0, 0, 5);">
<Label text="📝 题目" textFill="#4B0082" textAlignment="CENTER">
<font>
<Font name="System Bold" size="18.0"/>
</font>
</Label>
<Label fx:id="questionTextLabel" textFill="#4B0082" textAlignment="CENTER" wrapText="true" prefHeight="100.0" minHeight="100.0" style="-fx-background-color: linear-gradient(to bottom, white, #F8F0FF); -fx-padding: 25; -fx-background-radius: 15; -fx-border-color: #8A2BE2; -fx-border-radius: 15; -fx-border-width: 3; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.2), 8, 0, 0, 3);">
<font>
<Font name="System Bold" size="20.0"/>
</font>
</Label>
<!-- 选项区域 -->
<VBox spacing="15.0" style="-fx-padding: 20; -fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 15; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 5, 0, 0, 2);">
<Label text="🔘 请选择答案" textFill="#4B0082" textAlignment="CENTER">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<VBox spacing="12.0">
<RadioButton fx:id="optionA" text="A. 选项A" prefHeight="45.0" minHeight="45.0" style="-fx-font-size: 16; -fx-font-weight: bold; -fx-text-fill: #4B0082; -fx-padding: 12; -fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 10; -fx-border-color: #8A2BE2; -fx-border-radius: 10; -fx-border-width: 2; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 3, 0, 0, 1);"/>
<RadioButton fx:id="optionB" text="B. 选项B" prefHeight="45.0" minHeight="45.0" style="-fx-font-size: 16; -fx-font-weight: bold; -fx-text-fill: #4B0082; -fx-padding: 12; -fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 10; -fx-border-color: #8A2BE2; -fx-border-radius: 10; -fx-border-width: 2; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 3, 0, 0, 1);"/>
<RadioButton fx:id="optionC" text="C. 选项C" prefHeight="45.0" minHeight="45.0" style="-fx-font-size: 16; -fx-font-weight: bold; -fx-text-fill: #4B0082; -fx-padding: 12; -fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 10; -fx-border-color: #8A2BE2; -fx-border-radius: 10; -fx-border-width: 2; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 3, 0, 0, 1);"/>
<RadioButton fx:id="optionD" text="D. 选项D" prefHeight="45.0" minHeight="45.0" style="-fx-font-size: 16; -fx-font-weight: bold; -fx-text-fill: #4B0082; -fx-padding: 12; -fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 10; -fx-border-color: #8A2BE2; -fx-border-radius: 10; -fx-border-width: 2; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 3, 0, 0, 1);"/>
</VBox>
</VBox>
</VBox>
<!-- 操作按钮区域 -->
<HBox spacing="20.0" alignment="CENTER" style="-fx-background-color: rgba(255,255,255,0.9); -fx-background-radius: 15; -fx-padding: 20; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.2), 8, 0, 0, 3);">
<Button fx:id="submitButton" text="✅ 提交答案" onAction="#handleSubmitAnswer" style="-fx-background-color: linear-gradient(to right, #32CD32, #228B22); -fx-text-fill: white; -fx-background-radius: 12; -fx-padding: 15 30; -fx-font-size: 16; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
<Button fx:id="nextButton" text="➡️ 下一题" onAction="#handleNextQuestion" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC); -fx-text-fill: white; -fx-background-radius: 12; -fx-padding: 15 30; -fx-font-size: 16; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
<Button fx:id="exitExamButton" text="🚪 退出考试" onAction="#handleExitExam" style="-fx-background-color: linear-gradient(to right, #DC143C, #B22222); -fx-text-fill: white; -fx-background-radius: 12; -fx-padding: 15 30; -fx-font-size: 16; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
</HBox>
<!-- 进度条 -->
<VBox spacing="10.0" alignment="CENTER">
<Label text="📊 考试进度" textFill="#4B0082" textAlignment="CENTER">
<font>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
<ProgressBar fx:id="progressBar" prefWidth="400.0" style="-fx-background-radius: 10; -fx-border-radius: 10; -fx-border-color: #8A2BE2; -fx-border-width: 2;"/>
<Label fx:id="progressLabel" textFill="#4B0082" textAlignment="CENTER" style="-fx-background-color: rgba(255,255,255,0.9); -fx-padding: 8 15; -fx-background-radius: 15; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.2), 3, 0, 0, 1);">
<font>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
</VBox>
</VBox>
</center>
</BorderPane>

@ -4,162 +4,109 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.paint.LinearGradient?>
<?import javafx.scene.paint.Stop?>
<BorderPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.mathsystemtogether.ExamController"> <BorderPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.mathsystemtogether.ExamController" style="-fx-background-color: linear-gradient(to bottom, #6A0DAD, #4B0082, #2E0854);">
<top> <top>
<VBox spacing="10.0"> <VBox spacing="15.0" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC, #8B008B); -fx-background-radius: 15; -fx-padding: 20;">
<padding> <padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> <Insets bottom="15.0" left="20.0" right="20.0" top="20.0"/>
</padding> </padding>
<Label text="数学考试系统" textFill="#2E8B57" textAlignment="CENTER"> <Label text="🎓 数学考试系统" textFill="white" textAlignment="CENTER" style="-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.5), 10, 0, 0, 2);">
<font>
<Font name="System Bold" size="28.0"/>
</font>
</Label>
<Label text="✨ 智能答题 · 实时评分 · 酷炫体验" textFill="#E6E6FA" textAlignment="CENTER">
<font> <font>
<Font name="System Bold" size="24.0"/> <Font name="System" size="14.0"/>
</font> </font>
</Label> </Label>
<Separator/>
</VBox> </VBox>
</top> </top>
<center> <center>
<VBox spacing="15.0"> <VBox spacing="10.0">
<padding> <padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/> <Insets bottom="10.0" left="15.0" right="15.0" top="10.0"/>
</padding> </padding>
<!-- 登录区域 --> <!-- 登录区域 -->
<VBox spacing="10.0" style="-fx-background-color: #F0F8FF; -fx-padding: 15; -fx-background-radius: 10;"> <VBox spacing="15.0" style="-fx-background-color: linear-gradient(to bottom, #E6E6FA, #D8BFD8, #DDA0DD); -fx-padding: 20; -fx-background-radius: 15; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.3), 15, 0, 0, 5);">
<Label text="用户登录" textFill="#2E8B57"> <Label text="🔐 用户登录" textFill="#4B0082" textAlignment="CENTER">
<font> <font>
<Font name="System Bold" size="16.0"/> <Font name="System Bold" size="18.0"/>
</font> </font>
</Label> </Label>
<HBox spacing="10.0" alignment="CENTER_LEFT"> <HBox spacing="15.0" alignment="CENTER_LEFT">
<Label text="用户名:" minWidth="80.0"/> <Label text="👤 用户名:" minWidth="80.0" textFill="#6A0DAD">
<TextField fx:id="usernameField" promptText="请输入用户名" prefWidth="150.0"/> <font>
</HBox> <Font name="System Bold" size="14.0"/>
<HBox spacing="10.0" alignment="CENTER_LEFT"> </font>
<Label text="密码:" minWidth="80.0"/> </Label>
<PasswordField fx:id="passwordField" promptText="请输入密码" prefWidth="150.0"/> <TextField fx:id="usernameField" promptText="请输入用户名" prefWidth="180.0" style="-fx-background-color: white; -fx-background-radius: 8; -fx-border-color: #8A2BE2; -fx-border-radius: 8; -fx-border-width: 2; -fx-padding: 8;"/>
</HBox>
<HBox spacing="10.0" alignment="CENTER_LEFT">
<Button fx:id="loginButton" text="登录" onAction="#handleLogin" style="-fx-background-color: #4CAF50; -fx-text-fill: white; -fx-background-radius: 5;"/>
<Label fx:id="loginStatusLabel" textFill="#FF0000"/>
</HBox> </HBox>
</VBox>
<!-- 考试设置区域 -->
<VBox fx:id="examSetupPanel" spacing="15.0" style="-fx-background-color: #F5F5F5; -fx-padding: 15; -fx-background-radius: 10;">
<Label fx:id="welcomeLabel" text="欢迎使用数学考试系统" textFill="#2E8B57">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<HBox spacing="15.0" alignment="CENTER_LEFT"> <HBox spacing="15.0" alignment="CENTER_LEFT">
<Label text="难度级别:" minWidth="80.0"/> <Label text="🔑 密码:" minWidth="80.0" textFill="#6A0DAD">
<ComboBox fx:id="levelComboBox" prefWidth="120.0"/> <font>
<Label text="题目数量:" minWidth="80.0"/> <Font name="System Bold" size="14.0"/>
<TextField fx:id="questionCountField" promptText="5-20" prefWidth="80.0"/> </font>
<Button fx:id="startExamButton" text="开始考试" onAction="#handleStartExam" style="-fx-background-color: #2196F3; -fx-text-fill: white; -fx-background-radius: 5;"/> </Label>
<PasswordField fx:id="passwordField" promptText="请输入密码" prefWidth="180.0" style="-fx-background-color: white; -fx-background-radius: 8; -fx-border-color: #8A2BE2; -fx-border-radius: 8; -fx-border-width: 2; -fx-padding: 8;"/>
</HBox> </HBox>
<HBox spacing="15.0" alignment="CENTER_LEFT">
<HBox spacing="10.0" alignment="CENTER_LEFT"> <Button fx:id="loginButton" text="🚀 登录" onAction="#handleLogin" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC); -fx-text-fill: white; -fx-background-radius: 10; -fx-padding: 10 20; -fx-font-size: 14; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
<Button fx:id="logoutButton" text="退出登录" onAction="#handleLogout" style="-fx-background-color: #F44336; -fx-text-fill: white; -fx-background-radius: 5;"/> <Label fx:id="loginStatusLabel" textFill="#8B0000" style="-fx-font-weight: bold;"/>
</HBox> </HBox>
<Label fx:id="statusLabel" textFill="#2E8B57"/>
</VBox> </VBox>
<!-- 考试界面 --> <!-- 考试设置区域 -->
<VBox fx:id="examPanel" spacing="15.0" style="-fx-background-color: #FFF8DC; -fx-padding: 20; -fx-background-radius: 10;"> <VBox fx:id="examSetupPanel" spacing="15.0" style="-fx-background-color: linear-gradient(to bottom, #F8F0FF, #E6E6FA, #D8BFD8); -fx-padding: 20; -fx-background-radius: 15; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.2), 10, 0, 0, 3);">
<Label text="考试进行中" textFill="#2E8B57" textAlignment="CENTER"> <Label fx:id="welcomeLabel" text="🎯 欢迎使用数学考试系统" textFill="#4B0082" textAlignment="CENTER">
<font> <font>
<Font name="System Bold" size="18.0"/> <Font name="System Bold" size="18.0"/>
</font> </font>
</Label> </Label>
<Label fx:id="questionNumberLabel" textFill="#2E8B57" textAlignment="CENTER"> <HBox spacing="20.0" alignment="CENTER_LEFT">
<font> <Label text="📚 难度级别:" minWidth="100.0" textFill="#6A0DAD">
<Font name="System Bold" size="14.0"/>
</font>
</Label>
<Label fx:id="questionTextLabel" textFill="#2E8B57" textAlignment="CENTER" wrapText="true" style="-fx-background-color: #E6F3FF; -fx-padding: 15; -fx-background-radius: 5;">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<VBox spacing="10.0" style="-fx-padding: 10;">
<RadioButton fx:id="optionA" text="A. 选项A" style="-fx-font-size: 14;"/>
<RadioButton fx:id="optionB" text="B. 选项B" style="-fx-font-size: 14;"/>
<RadioButton fx:id="optionC" text="C. 选项C" style="-fx-font-size: 14;"/>
<RadioButton fx:id="optionD" text="D. 选项D" style="-fx-font-size: 14;"/>
</VBox>
<HBox spacing="10.0" alignment="CENTER">
<Button fx:id="submitButton" text="提交答案" onAction="#handleSubmitAnswer" style="-fx-background-color: #4CAF50; -fx-text-fill: white; -fx-background-radius: 5; -fx-font-size: 14;"/>
<Button fx:id="nextButton" text="下一题" onAction="#handleNextQuestion" style="-fx-background-color: #2196F3; -fx-text-fill: white; -fx-background-radius: 5; -fx-font-size: 14;"/>
<Button fx:id="exitExamButton" text="退出考试" onAction="#handleExitExam" style="-fx-background-color: #F44336; -fx-text-fill: white; -fx-background-radius: 5; -fx-font-size: 14;"/>
</HBox>
<Label fx:id="progressLabel" textFill="#2E8B57" textAlignment="CENTER">
<font>
<Font name="System Bold" size="12.0"/>
</font>
</Label>
</VBox>
<!-- 结果界面 -->
<VBox fx:id="resultPanel" spacing="15.0" style="-fx-background-color: #F0FFF0; -fx-padding: 20; -fx-background-radius: 10;">
<Label fx:id="resultTitleLabel" text="考试结果" textFill="#2E8B57" textAlignment="CENTER">
<font>
<Font name="System Bold" size="20.0"/>
</font>
</Label>
<HBox spacing="20.0" alignment="CENTER">
<Label fx:id="scoreLabel" text="得分: 0分" textFill="#2E8B57">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<Label fx:id="correctCountLabel" text="正确: 0题" textFill="#2E8B57">
<font> <font>
<Font name="System Bold" size="16.0"/> <Font name="System Bold" size="14.0"/>
</font> </font>
</Label> </Label>
<Label fx:id="totalCountLabel" text="总计: 0题" textFill="#2E8B57"> <ComboBox fx:id="levelComboBox" prefWidth="140.0" style="-fx-background-color: white; -fx-background-radius: 8; -fx-border-color: #8A2BE2; -fx-border-radius: 8; -fx-border-width: 2;"/>
<Label text="🔢 题目数量:" minWidth="100.0" textFill="#6A0DAD">
<font> <font>
<Font name="System Bold" size="16.0"/> <Font name="System Bold" size="14.0"/>
</font> </font>
</Label> </Label>
<TextField fx:id="questionCountField" promptText="5-20" prefWidth="100.0" style="-fx-background-color: white; -fx-background-radius: 8; -fx-border-color: #8A2BE2; -fx-border-radius: 8; -fx-border-width: 2; -fx-padding: 8;"/>
<Button fx:id="startExamButton" text="🚀 开始考试" onAction="#handleStartExam" style="-fx-background-color: linear-gradient(to right, #8A2BE2, #9932CC); -fx-text-fill: white; -fx-background-radius: 10; -fx-padding: 12 25; -fx-font-size: 14; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
</HBox> </HBox>
<Label text="详细结果:" textFill="#2E8B57"> <HBox spacing="15.0" alignment="CENTER_LEFT">
<font> <Button fx:id="logoutButton" text="🚪 退出登录" onAction="#handleLogout" style="-fx-background-color: linear-gradient(to right, #DC143C, #B22222); -fx-text-fill: white; -fx-background-radius: 10; -fx-padding: 10 20; -fx-font-size: 14; -fx-font-weight: bold; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 5, 0, 0, 2);"/>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
<TextArea fx:id="resultDetailsArea" editable="false" prefHeight="200.0" style="-fx-font-family: 'Courier New'; -fx-font-size: 12;"/>
<HBox spacing="10.0" alignment="CENTER">
<Button fx:id="restartButton" text="重新考试" onAction="#handleRestart" style="-fx-background-color: #2196F3; -fx-text-fill: white; -fx-background-radius: 5;"/>
<Button fx:id="backToLoginButton" text="返回登录" onAction="#handleBackToLogin" style="-fx-background-color: #9C27B0; -fx-text-fill: white; -fx-background-radius: 5;"/>
</HBox> </HBox>
<Label fx:id="statusLabel" textFill="#4B0082" style="-fx-font-weight: bold; -fx-font-size: 14;"/>
</VBox> </VBox>
<!-- 使用说明 --> <!-- 使用说明 -->
<VBox spacing="10.0" style="-fx-background-color: #E8F5E8; -fx-padding: 15; -fx-background-radius: 10;"> <VBox spacing="15.0" style="-fx-background-color: linear-gradient(to bottom, #F8F0FF, #E6E6FA, #D8BFD8); -fx-padding: 20; -fx-background-radius: 15; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.2), 10, 0, 0, 3);">
<Label text="使用说明" textFill="#2E8B57"> <Label text="📖 使用说明" textFill="#4B0082" textAlignment="CENTER">
<font> <font>
<Font name="System Bold" size="14.0"/> <Font name="System Bold" size="16.0"/>
</font> </font>
</Label> </Label>
<Label text="1. 使用预设账号登录张三1/123, 李四1/123, 王五1/123" textFill="#2E8B57"/> <VBox spacing="8.0" style="-fx-padding: 10; -fx-background-color: rgba(255,255,255,0.8); -fx-background-radius: 10; -fx-effect: dropshadow(gaussian, rgba(139,0,139,0.1), 5, 0, 0, 2);">
<Label text="2. 选择难度级别(小学/初中/高中和题目数量5-20" textFill="#2E8B57"/> <Label text="① 使用预设账号登录张三1/123, 李四1/123, 王五1/123" textFill="#6A0DAD" style="-fx-font-weight: bold;"/>
<Label text="3. 点击'开始考试'进入考试界面" textFill="#2E8B57"/> <Label text="② 选择难度级别(小学/初中/高中和题目数量5-20" textFill="#6A0DAD" style="-fx-font-weight: bold;"/>
<Label text="4. 选择答案后点击'提交答案',系统自动进入下一题" textFill="#2E8B57"/> <Label text="③ 点击'开始考试'进入考试界面" textFill="#6A0DAD" style="-fx-font-weight: bold;"/>
<Label text="5. 完成所有题目后查看考试结果" textFill="#2E8B57"/> <Label text="④ 选择答案后点击'提交答案',系统自动进入下一题" textFill="#6A0DAD" style="-fx-font-weight: bold;"/>
<Label text="⑤ 完成所有题目后查看考试结果" textFill="#6A0DAD" style="-fx-font-weight: bold;"/>
</VBox>
</VBox> </VBox>
</VBox> </VBox>
</center> </center>

Loading…
Cancel
Save