我应该如何将javafx.stage.FileChooser添加到javafx gui应用程序的场景中。
我做了以下工作
Group root = new Group();
Scene scene = new Scene(root,800,800,Color.BLANCHEDALMOND);
FileChooser fc = new FileChooser();
root.getChildren().add(fc);然而,我得到了以下错误。
no suitable method found for add(javafx.stage.FileChooser)
method java.util.List.add(int,javafx.scene.Node) is not applicable
(actual and formal argument lists differ in length)
method java.util.List.add(javafx.scene.Node) is not applicable
(actual argument javafx.stage.FileChooser cannot be converted to javafx.scene.Node by method invocation conversion)有人能提供一些建议吗?
发布于 2011-08-22 20:19:43
FileChooser不是一个节点,所以您不能将其添加到组中。
使用:
fc.showOpenDialog(null);或
fc.showSaveDialog(null);该参数是父窗口。如果我没记错的话,它可以是空的。
https://stackoverflow.com/questions/6855478
复制相似问题