表单初始加载后会触发什么事件? [英] What event fires after a form is initially loaded?

查看:127
本文介绍了表单初始加载后会触发什么事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我特别感兴趣的是一个事件,我可以在加载表单后挂钩,所以我可以在控制器代码中初始化字段等。

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.

推荐答案

没有事件,但您可以添加初始化方法,在创建内容并将字段注入控制器实例后由 FXMLLoader 调用:

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);
    }
}

这篇关于表单初始加载后会触发什么事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆