Search in sources :

Example 16 with FXMLLoader

use of javafx.fxml.FXMLLoader in project TeachingInSimulation by ScOrPiOzzy.

the class LoginApp method start.

@Override
public void start(Stage primaryStage) throws Exception {
    // 窗口无装饰
    primaryStage.initStyle(StageStyle.TRANSPARENT);
    FXMLLoader loader = new FXMLLoader();
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    Region loginView = loader.load(LoginApp.class.getResourceAsStream("/view/Login.fxml"));
    LoginController loginController = loader.getController();
    loader = new FXMLLoader();
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    Region settingView = loader.load(LoginApp.class.getResourceAsStream("/view/Network.fxml"));
    NetworkController settingController = loader.getController();
    // 手动注入
    settingController.setLoginView(loginView);
    // 
    loginController.setSettingView(settingView);
    // 背景无填充
    Scene scene = new Scene(loginView);
    scene.setOnMouseDragged(e -> {
        primaryStage.setX(e.getScreenX() + xOffset);
        primaryStage.setY(e.getScreenY() + yOffset);
    });
    scene.setOnMousePressed(e -> {
        // 按下鼠标后,记录当前鼠标的坐标
        xOffset = primaryStage.getX() - e.getScreenX();
        yOffset = primaryStage.getY() - e.getScreenY();
    });
    scene.setFill(null);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : LoginController(com.cas.sim.tis.view.controller.LoginController) Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) NetworkController(com.cas.sim.tis.view.controller.NetworkController)

Example 17 with FXMLLoader

use of javafx.fxml.FXMLLoader in project TeachingInSimulation by ScOrPiOzzy.

the class LeftMenu method loadFXML.

private void loadFXML() {
    FXMLLoader loader = new FXMLLoader();
    URL fxmlUrl = this.getClass().getResource("/view/LeftMenu.fxml");
    loader.setLocation(fxmlUrl);
    loader.setController(this);
    loader.setRoot(this);
    try {
        loader.load();
        LOG.debug("加载FXML界面{}完成", fxmlUrl);
    } catch (IOException e) {
        e.printStackTrace();
        LOG.error("加载FXML界面{}失败,错误信息:{}", fxmlUrl, e.getMessage());
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 18 with FXMLLoader

use of javafx.fxml.FXMLLoader in project TeachingInSimulation by ScOrPiOzzy.

the class StudentQuestionPaper method loadFXML.

/**
 * 加载界面布局文件
 */
private void loadFXML() {
    FXMLLoader loader = new FXMLLoader();
    URL fxmlUrl = this.getClass().getResource("/view/record/PaperForStudent.fxml");
    loader.setLocation(fxmlUrl);
    loader.setController(this);
    loader.setRoot(this);
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    try {
        loader.load();
        LOG.debug("加载FXML界面{}完成", fxmlUrl);
    } catch (IOException e) {
        e.printStackTrace();
        LOG.error("加载FXML界面{}失败,错误信息:{}", fxmlUrl, e.getMessage());
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 19 with FXMLLoader

use of javafx.fxml.FXMLLoader in project TeachingInSimulation by ScOrPiOzzy.

the class TeacherQuestionPaper method loadFXML.

/**
 * 加载界面布局文件
 */
private void loadFXML() {
    FXMLLoader loader = new FXMLLoader();
    URL fxmlUrl = this.getClass().getResource("/view/record/PaperForTeacher.fxml");
    loader.setLocation(fxmlUrl);
    loader.setController(this);
    loader.setRoot(this);
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    try {
        loader.load();
        LOG.debug("加载FXML界面{}完成", fxmlUrl);
    } catch (IOException e) {
        e.printStackTrace();
        LOG.error("加载FXML界面{}失败,错误信息:{}", fxmlUrl, e.getMessage());
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 20 with FXMLLoader

use of javafx.fxml.FXMLLoader in project TeachingInSimulation by ScOrPiOzzy.

the class ResourceList method loadFXML.

private void loadFXML() {
    FXMLLoader loader = new FXMLLoader();
    URL fxmlUrl = this.getClass().getResource("/view/resource/List.fxml");
    loader.setLocation(fxmlUrl);
    loader.setController(this);
    loader.setRoot(this);
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    try {
        loader.load();
        LOG.debug("加载FXML界面{}完成", fxmlUrl);
    } catch (IOException e) {
        e.printStackTrace();
        LOG.error("加载FXML界面{}失败,错误信息:{}", fxmlUrl, e.getMessage());
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Aggregations

FXMLLoader (javafx.fxml.FXMLLoader)252 IOException (java.io.IOException)148 Scene (javafx.scene.Scene)120 Parent (javafx.scene.Parent)79 Stage (javafx.stage.Stage)64 FXML (javafx.fxml.FXML)46 URL (java.net.URL)43 Pane (javafx.scene.layout.Pane)34 BorderPane (javafx.scene.layout.BorderPane)30 AnchorPane (javafx.scene.layout.AnchorPane)24 ActionEvent (javafx.event.ActionEvent)19 ResourceBundle (java.util.ResourceBundle)16 Initializable (javafx.fxml.Initializable)14 JFXButton (com.jfoenix.controls.JFXButton)13 KeyFrame (javafx.animation.KeyFrame)13 Timeline (javafx.animation.Timeline)13 StackPane (javafx.scene.layout.StackPane)13 Duration (javafx.util.Duration)13 Level (java.util.logging.Level)12 Logger (java.util.logging.Logger)12