diff --git a/pom.xml b/pom.xml index 56d7799..67d77d6 100644 --- a/pom.xml +++ b/pom.xml @@ -156,14 +156,14 @@ 0.0.8 - com.wsf.mathapp.App + com.wsf.mathapp.Main default-cli - com.wsf.mathapp.App + com.wsf.mathapp.Main diff --git a/src/main/java/com/wsf/mathapp/App.java b/src/main/java/com/wsf/mathapp/App.java deleted file mode 100644 index 8df2322..0000000 --- a/src/main/java/com/wsf/mathapp/App.java +++ /dev/null @@ -1,97 +0,0 @@ -// src/main/java/com/wsf/mathapp/App.java -package com.wsf.mathapp; - -import com.wsf.mathapp.controller.LoginController; -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.stage.Stage; -import java.io.IOException; - -public class App extends Application { - - private Stage primaryStage; - - @Override - public void start(Stage primaryStage) throws IOException { - this.primaryStage = primaryStage; - this.primaryStage.setTitle("数学学习软件"); - - showLoginScene(); - } - - public void showLoginScene() throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/login.fxml")); - Parent root = loader.load(); - LoginController controller = loader.getController(); - controller.setApp(this); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - primaryStage.show(); - } - - public void showRegisterScene() throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/register.fxml")); - Parent root = loader.load(); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - } - - public void showSetPasswordScene(String email) throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/set_password.fxml")); - Parent root = loader.load(); - // Pass email to SetPasswordController if needed - // SetPasswordController controller = loader.getController(); - // controller.setEmail(email); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - } - - public void showGradeSelectionScene() throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/grade_selection.fxml")); - Parent root = loader.load(); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - } - - public void showQuestionScene(java.util.List questions) throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/question.fxml")); - Parent root = loader.load(); - com.wsf.mathapp.controller.QuestionController controller = loader.getController(); - controller.setApp(this); - controller.setQuestions(questions); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - } - - public void showResultScene(com.wsf.mathapp.model.QuizResult result) throws IOException { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/wsf/mathapp/view/fxml/result.fxml")); - Parent root = loader.load(); - com.wsf.mathapp.controller.ResultController controller = loader.getController(); - controller.setApp(this); - controller.setResult(result); - - Scene scene = new Scene(root); - scene.getStylesheets().add(getClass().getResource("/com/wsf/mathapp/view/css/styles.css").toExternalForm()); - primaryStage.setScene(scene); - } - - public Stage getPrimaryStage() { - return primaryStage; - } - - public static void main(String[] args) { - launch(); - } -} \ No newline at end of file diff --git a/src/main/java/com/wsf/mathapp/Main.java b/src/main/java/com/wsf/mathapp/Main.java new file mode 100644 index 0000000..21c2960 --- /dev/null +++ b/src/main/java/com/wsf/mathapp/Main.java @@ -0,0 +1,17 @@ +package com.wsf.mathapp; + +import com.wsf.mathapp.controller.SceneManager; +import javafx.application.Application; +import javafx.stage.Stage; + +public class Main extends Application { + @Override + public void start(Stage primaryStage) { + SceneManager sceneManager = new SceneManager(primaryStage); + sceneManager.showLoginView(); + } + + public static void main(String[] args) { + launch(args); + } +} \ No newline at end of file diff --git a/src/main/java/com/wsf/mathapp/controller/Login.fxml b/src/main/java/com/wsf/mathapp/controller/Login.fxml deleted file mode 100644 index 14309c8..0000000 --- a/src/main/java/com/wsf/mathapp/controller/Login.fxml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - -