src/Controller/MainScreenController.java
/**
     * * Executes product search when the ENTER key is typed while the search
     * field is in focus.
     *
     * @param event
     */
Executes product search when the ENTER key is typed while the search
field is in focus.

@param event
Executes product search when the ENTER key is typed while the search field is in focus . @param event
@FXML
    private void productsSearchFieldEnterHandler(KeyEvent event
    ) {
        if (event.getCode() == KeyCode.ENTER) {
            String productSearchString = productsSearchField.getText();
            int searchedProductIndex;
            if (productSearchString.equals("")) {
                System.err.println("Empty search field present. Product search could not be conducted.");
                Alert emptySearchField = new Alert(Alert.AlertType.INFORMATION);
                emptySearchField.setTitle("ERROR: EMPTY FIELD");
                emptySearchField.setHeaderText("Unable to process search");
                emptySearchField.setContentText("Search field cannot be blank.");
                emptySearchField.showAndWait();
            } else if (Inventory.lookupProduct(productSearchString) == -1) {
                System.err.println("Product not found. Search returned no results.");
                Alert productNotFound = new Alert(Alert.AlertType.INFORMATION);
                productNotFound.setTitle("ERROR: PRODUCT NOT FOUND");
                productNotFound.setHeaderText("Unable to locate product");
                productNotFound.setContentText("The Product ID or name entered was not found in inventory.");
                productNotFound.showAndWait();
            } else {
                System.out.println("Product search succeeded. Products table view updated.");
                searchedProductIndex = Inventory.lookupProduct(productSearchString);
                Product searchedProduct = Inventory.getAllProducts().get(searchedProductIndex);
                ObservableList<Product> searchedProductList = FXCollections.observableArrayList();
                searchedProductList.add(searchedProduct);
                productsTable.setItems(searchedProductList);
                productsSearchField.setText("");
            }
        }
    }
@ FXML private void productsSearchFieldEnterHandler ( KeyEvent event ) { if ( event . getCode ( ) == KeyCode . ENTER ) { String productSearchString = productsSearchField . getText ( ) ; int searchedProductIndex ; if ( productSearchString . equals ( "" ) ) { System . err . println ( "Empty search field present. Product search could not be conducted." ) ; Alert emptySearchField = new Alert ( Alert . AlertType . INFORMATION ) ; emptySearchField . setTitle ( "ERROR: EMPTY FIELD" ) ; emptySearchField . setHeaderText ( "Unable to process search" ) ; emptySearchField . setContentText ( "Search field cannot be blank." ) ; emptySearchField . showAndWait ( ) ; } else if ( Inventory . lookupProduct ( productSearchString ) == - 1 ) { System . err . println ( "Product not found. Search returned no results." ) ; Alert productNotFound = new Alert ( Alert . AlertType . INFORMATION ) ; productNotFound . setTitle ( "ERROR: PRODUCT NOT FOUND" ) ; productNotFound . setHeaderText ( "Unable to locate product" ) ; productNotFound . setContentText ( "The Product ID or name entered was not found in inventory." ) ; productNotFound . showAndWait ( ) ; } else { System . out . println ( "Product search succeeded. Products table view updated." ) ; searchedProductIndex = Inventory . lookupProduct ( productSearchString ) ; Product searchedProduct = Inventory . getAllProducts ( ) . get ( searchedProductIndex ) ; ObservableList < Product > searchedProductList = FXCollections . observableArrayList ( ) ; searchedProductList . add ( searchedProduct ) ; productsTable . setItems ( searchedProductList ) ; productsSearchField . setText ( "" ) ; } } }
* Executes product search when the ENTER key is typed while the search
 field is in focus.
* Executes product search when the ENTER key is typed while the search field is in focus .