use of com.cas.sim.tis.view.controller.NetworkController 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();
}
Aggregations