/** Loads the name of all ingredients and puts them in ingredientlist. */ public void updateIngredients() { ArrayList<ArrayList<String>> dataSet; ObservableList<String> itemList = FXCollections.observableArrayList(); // Observable arraylist for the listview try { System.out.println("- Main updateIngredientsRecipList"); dataSet = fetchData("Ingredients", "Name"); // Gives the arraylist the ingredientnames for (ArrayList<String> element : dataSet) { itemList.add(element.get(0)); // For every element in the array, get name } System.out.println("- end of Main updateIngredientsRecipList"); } catch (SQLException e) { e.printStackTrace(); } recipeIngredients.setItems(itemList); // Sets the Listview to show the obs arraylist itemList.clear(); try { dataSet = fetchData("Units", "*"); for (ArrayList<String> element : dataSet) { itemList.add(element.get(1)); } } catch (SQLException e) { e.printStackTrace(); } ingredientUnit.setItems(itemList); }