たとえば、ボタンをクリックしたときにDirectoryChooserを開きたいとします。
<VBox fx:controller="com.foo.MyController"
xmlns:fx="http://javafx.com/fxml">
<children>
<Button text="Click Me!" onAction="#handleButtonAction"/>
</children>
</VBox>
そしてControllerクラス:
package com.foo;
public class MyController {
public void handleButtonAction(ActionEvent event) {
DirectoryChooser dc = new DirectoryChooser();
File folder = dc.showDialog(null);//I want to put the WIndows here.
}
}
メインウィンドウをShowDialogに配置してブロックしたいのですが、どうすればアクセスできますか?