Search in sources :

Example 1 with DrawingController

use of com.cas.sim.tis.view.controller.DrawingController in project TeachingInSimulation by ScOrPiOzzy.

the class TypicalCaseBtnController method showDrawingWin.

@FXML
private void showDrawingWin(ActionEvent event) {
    ((Button) event.getSource()).setDisable(true);
    try {
        if (drawingWin == null) {
            drawingWin = new Stage();
            drawingWin.initStyle(StageStyle.TRANSPARENT);
            drawingWin.setX(GUIState.getStage().getX() + 100);
            drawingWin.setY(GUIState.getStage().getY() + 100);
            FXMLLoader loader = new FXMLLoader();
            loader.setResources(ResourceBundle.getBundle("i18n/messages"));
            Region root = loader.load(TypicalCaseBtnController.class.getResourceAsStream("/view/jme/Drawing.fxml"));
            DrawingController controller = loader.getController();
            controller.setStage(drawingWin);
            controller.setUI(typicalCase3D);
            Scene scene = new Scene(root);
            drawingWin.setScene(scene);
            drawingWin.setOnHidden(e -> {
                ((Button) event.getSource()).setDisable(false);
            });
        }
        drawingWin.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Button(javafx.scene.control.Button) Stage(javafx.stage.Stage) Region(javafx.scene.layout.Region) IOException(java.io.IOException) DrawingController(com.cas.sim.tis.view.controller.DrawingController) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) FXML(javafx.fxml.FXML)

Aggregations

DrawingController (com.cas.sim.tis.view.controller.DrawingController)1 IOException (java.io.IOException)1 FXML (javafx.fxml.FXML)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Scene (javafx.scene.Scene)1 Button (javafx.scene.control.Button)1 Region (javafx.scene.layout.Region)1 Stage (javafx.stage.Stage)1