How to open another window in JavaFX 2?

匿名 (未验证) 提交于 2019-12-03 01:12:01

问题:

I have made a simple JavaFX application, but I would like the main window to open a secondary window when the user clicks a button.

What would be the simplest way to accomplish this?

回答1:

Button b = new Button(); b.setOnAction(new EventHandler() {     @Override public void handle(ActionEvent e) {         Stage stage = new Stage();         //Fill stage with content         stage.show();     } }); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!