Connor Goddard 1337
Connor Goddard 1337

Reputation: 1

Only close JavaFX application

I am trying to make a LWJGL game run a JavaFX application and the game, then close only the JavaFX application, but doing System.exit(0) closes both windows.

How can I get the desired result

Upvotes: 0

Views: 96

Answers (1)

Drashti Pandya
Drashti Pandya

Reputation: 358

You can create a common close function where You just need to pass Node. Node can be Button, ComboBox, TextField etc.

public static Stage closeConfirmView(Node node) throws IOException {        
        Stage primaryStage = (Stage) node.getScene().getWindow();
        primaryStage.close();
        return primaryStage;        
}

Upvotes: 1

Related Questions