0

这就是功能。错误在 stage.initStyle(StageStyle.UNDECORATED); 这表示在舞台可见后无法设置样式。你能帮我在哪里我应该在函数中声明它并建议一些需要的代码编辑(如果有的话)。

@FXML
public void Showmain() {
    // Handle Button event.
    myButton3.setOnAction((e) -> {
        System.out.println("Project screen");




    //  FXMLLoader fxmlLoader1= new FXMLLoader(getClass().getResource("Projectscreen.fxml"));
           try {

               Node node = (Node) e.getSource();               
                Stage stage = (Stage) node.getScene().getWindow();
             //   
                scene = stage.getScene();
                stage.setWidth(1280);
                stage.setHeight(968);
                stage.centerOnScreen();
                stage.setTitle("Welcome to Kdaf");
              //  stage.initStyle(StageStyle.UNDECORATED); 
                //stage.setResizable(false);
                FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Projectscreen.fxml"));
                Parent root = (Parent) fxmlLoader.load();
                scene.setRoot(root);

           } catch (IOException exception) {
                throw new RuntimeException(exception);
            }

           });







}
4

0 回答 0