@FXML
    private void handleButtonAction(ActionEvent event) throws Exception {
        System.out.println("You clicked me!");
        label.setText("Hello World!");

        //aslo I want to show another scence

        //1.Get application stage
        Stage currentStage = (Stage) ((Node) event.getSource()).getScene().getWindow();
        //2.Create new scence from fxml
        Parent root = FXMLLoader.load(getClass().getResource("mainUI/mianUI.fxml"));

        Scene scene1 = new Scene(root);
        //3.Set new scence to the stage
        currentStage.setScene(scene1);
        //currentStage.show();
    }

 

相关文章:

  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2021-09-24
  • 2021-11-03
  • 2022-12-23
猜你喜欢
  • 2021-06-18
  • 2022-03-03
  • 2021-08-12
  • 2021-08-07
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案