How to close a java window with a button click - JavaFX Project

后端 未结 6 1861
忘掉有多难
忘掉有多难 2020-12-05 18:26

I made a JavaFX project and created the GUI for the first-login frame in the java Scene Builder. When the login is successful, the login frame must be closed and the next fr

6条回答
  •  天命终不由人
    2020-12-05 19:01

    Although

        getScene().getWindow();
    

    on a Node will get you the stage from the controller, it's important to note that calling close() or hide() are equivalent, and will simply make the login window invisible. As for using dispose():

    This link might help to clear up any confusion.

提交回复
热议问题