src/Controller/AddPartController.java
/**
     * *
     * Cancel button displays a CONFIRMATION alert requesting user to confirm
     * cancel and if they confirm then they are returned to the application's
     * main screen.
     */
Cancel button displays a CONFIRMATION alert requesting user to confirm
cancel and if they confirm then they are returned to the application's
main screen.
Cancel button displays a CONFIRMATION alert requesting user to confirm cancel and if they confirm then they are returned to the application ' s main screen .
@FXML
    private void cancelBtnHandler(ActionEvent event) throws IOException {
        Alert cancelAlert = new Alert(Alert.AlertType.CONFIRMATION);
        cancelAlert.setTitle("CONFIRMATION: EXIT TO MAIN SCREEN");
        cancelAlert.setHeaderText("Would you like to cancel this operation?");
        cancelAlert.setContentText("Click OK to cancel operation and return to the main screen.\nClick CANCEL to continue and return to the current screen.");
        cancelAlert.showAndWait();
        if (cancelAlert.getResult() == ButtonType.OK) {
            System.out.println("User cancelled operation.\nExiting to Main Screen.");
            Parent root = FXMLLoader.load(getClass().getResource("/View/MainScreen.fxml"));
            Scene mainScreen = new Scene(root);
            Stage mainScreenWindow = (Stage) ((Node) event.getSource()).getScene().getWindow();
            mainScreenWindow.setTitle("ABC Company: Inventory Management System");
            mainScreenWindow.setScene(mainScreen);
            mainScreenWindow.show();
        } else {
            cancelAlert.close();
        }
    }
@ FXML private void cancelBtnHandler ( ActionEvent event ) throws IOException { Alert cancelAlert = new Alert ( Alert . AlertType . CONFIRMATION ) ; cancelAlert . setTitle ( "CONFIRMATION: EXIT TO MAIN SCREEN" ) ; cancelAlert . setHeaderText ( "Would you like to cancel this operation?" ) ; cancelAlert . setContentText ( "Click OK to cancel operation and return to the main screen.\nClick CANCEL to continue and return to the current screen." ) ; cancelAlert . showAndWait ( ) ; if ( cancelAlert . getResult ( ) == ButtonType . OK ) { System . out . println ( "User cancelled operation.\nExiting to Main Screen." ) ; Parent root = FXMLLoader . load ( getClass ( ) . getResource ( "/View/MainScreen.fxml" ) ) ; Scene mainScreen = new Scene ( root ) ; Stage mainScreenWindow = ( Stage ) ( ( Node ) event . getSource ( ) ) . getScene ( ) . getWindow ( ) ; mainScreenWindow . setTitle ( "ABC Company: Inventory Management System" ) ; mainScreenWindow . setScene ( mainScreen ) ; mainScreenWindow . show ( ) ; } else { cancelAlert . close ( ) ; } }
Cancel button displays a CONFIRMATION alert requesting user to confirm
 cancel and if they confirm then they are returned to the application's
 main screen.
Cancel button displays a CONFIRMATION alert requesting user to confirm cancel and if they confirm then they are returned to the application ' s main screen .