我正在寻找 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
函数。它们使用有用的默认值自动为您处理毛茸茸的部分,但是(因为它们毕竟只是默认值)您可以轻松地覆盖它们以根据您的需要定制功能。
关于javafx - 应该将什么传递给 FileChooser?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40731511/