加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

javafx – TornadoFX filechooser

发布时间:2020-12-14 16:33:00 所属栏目:Java 来源:网络整理
导读:我正在寻找 javafx FileChooser(在Kotlin中)的解决方案.我坚持这个,我无法通过root View,因为Window!是期待: button("open some file") { setOnAction { val fileChooser = FileChooser(); val file = fileChooser.showOpenDialog(???) ... } } 在这种情况
我正在寻找 javafx FileChooser(在Kotlin中)的解决方案.我坚持这个,我无法通过root View,因为Window!是期待:
button("open some file") {

                    setOnAction {
                        val fileChooser = FileChooser();
                        val file = fileChooser.showOpenDialog(???)
                        ...
                    }

                }

在这种情况下我应该通过什么?

解决方法

According to the docs你可以为窗口传递一个null.

If the owner window for the file dialog is set,input to all windows in the dialog’s owner chain is blocked while the file dialog is being shown.

但是,由于您使用的是TornadoFX,因此您可能只想使用它提供的chooseFile和chooseDirectory函数.它们会为您提供有用的默认值,但是(因为它们只是默认值),您可以轻松地覆盖它们以根据您的需要定制功能.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读