What event fires after a form is initially loaded?

后端 未结 1 1676
余生分开走
余生分开走 2021-01-28 11:44

I\'m particularly interested in an event I can hook into that fires after the form is loaded so I can initialize the fields, etc., in the controller code.

1条回答
  •  旧时难觅i
    2021-01-28 12:01

    There is no event, but you could add a initialize method, which is invoked by the FXMLLoader after the content is created and fields are injected to the controller instance:

    public MyController {
    
        @FXML
        private Node someNode;
    
        @FXML
        private void initialize() {
            System.out.println("someNode: " + someNode);
        }
    }
    

    0 讨论(0)
提交回复
热议问题