iT邦幫忙

0

使用JAVAFX Controller 要怎麼讓他按一個button後開啟新視窗

https://ithelp.ithome.com.tw/upload/images/20210505/20137215xkC8BhE5f1.png
我希望能作出按下buy這個button就能夠跳出一個新視窗
請問有甚麼辦法能夠寫出來嗎?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
koro_michael
iT邦新手 2 級 ‧ 2021-05-07 10:25:56
Parent root;
try {
    root = FXMLLoader.load(getClass().getClassLoader().getResource("你的fxml"), resources);
    Stage stage = new Stage();
    stage.setTitle("My New Stage Title");
    stage.setScene(new Scene(root, 450, 450));
    stage.show();
}
catch (IOException e) {
    e.printStackTrace();
}

我要發表回答

立即登入回答