我正在使用 javafx,想在按钮的“setOnAction”中编写代码来关闭 javafx1 类并运行 javafx2 类,但我看到错误“应用程序启动不能被多次调用”。我怎样才能解决这个问题?
//This code is in the class JavaFX1:
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
JavaFX2.main(null); //How can i change current line?
stage.close();
}
});