Store dynamic screen with multiple stages

后端 未结 2 1762
终归单人心
终归单人心 2020-12-22 06:00

I´ve got 2 different screens, in the first screen the user can load images and the other one is just a single button (the stage is invisible so the stage has to be different

2条回答
  •  难免孤独
    2020-12-22 06:12

    if the primaryStage is where "user can load images" do :

    static Stage primaryStage;
    
    @FXML
    private void goToScreen1(ActionEvent event) throws Exception{
    
    
        Stage stage = (Stage) showStage.getScene().getWindow();
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/sample.fxml"));
        Parent root = fxmlLoader.load();
    
        if(primaryStage==null)
        primaryStage = new Stage();
    
        primaryStage.setResizable(true);
        primaryStage.setOpacity(0.0);
        primaryStage.show();
    
        primaryStage.setX(0);
        primaryStage.setY(0);
        primaryStage.setHeight(primScreenBounds.getHeight());
        primaryStage.setWidth(primScreenBounds.getWidth() / 2);
    

    }

提交回复
热议问题