gpt4 book ai didi

javafx - 应该将什么传递给 FileChooser?

转载 作者:IT老高 更新时间:2023-10-28 13:44:10 27 4
gpt4 key购买 nike

我正在寻找 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,您可能只想使用它提供的 chooseFilechooseDirectory 函数。它们使用有用的默认值自动为您处理毛茸茸的部分,但是(因为它们毕竟只是默认值)您可以轻松地覆盖它们以根据您的需要定制功能。

关于javafx - 应该将什么传递给 FileChooser?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40731511/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com