Skip to content

Commit

Permalink
Exit Button Added
Browse files Browse the repository at this point in the history
Placement location likely not permanent
  • Loading branch information
whernandez23 authored May 13, 2021
1 parent d5ead55 commit d8f2f75
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion Expedia/src/application/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,42 @@ else if(CardF.getText().isEmpty()) {
}

});

Button exitButton = new Button("EXIT");
exitButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent e)
{
Platform.runLater(new Runnable()
{
public void run()
{
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);

alert.setTitle("Confirmation Dialog");
alert.setHeaderText("EXIT confirmation dialog");
alert.setContentText("Are you sure you want to exit this Socket Server Program?");

Optional<ButtonType> result = alert.showAndWait();

if (result.get() == ButtonType.OK)
{
sockServer.writeHashTableData();
System.exit(0);
}
else
{
// ... user chose CANCEL or closed the dialog
}
}
});
}
});

//Gridpane for payment
contact.add(submitButton, 1, 7, 1, 1);
contact.add(submitButton, 1, 7, 1, 1);
contact.add(exitButton, 2, 8, 1, 1);
contact.setVgap(5);

//Gridpane for Body
Expand Down

0 comments on commit d8f2f75

Please sign in to comment.