private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed
if (nameTextField.getText() == null ? "" == null : nameTextField.getText().equals("")) {
JOptionPane.showMessageDialog(this, "You need a name for an ingredient");
} else {
IngredientType ing = new IngredientType();
ing.setName(nameTextField.getText());
if (amountTextField.getText() == null ? "" == null : amountTextField.getText().equals("")) {
ing.setNumerator(0);
ing.setDenominator(0);
} else if (amountTextField.getText().contains("/")) {
String[] amounts = amountTextField.getText().split("/");
ing.setNumerator(Integer.parseInt(amounts[0]));
ing.setDenominator(Integer.parseInt(amounts[1]));
} else {
ing.setDenominator(0);
ing.setNumerator(Integer.parseInt(amountTextField.getText()));
}
ing.setUnit(unitTextField.getText());
recipeParent.addIngredient(ing);
dispose();
}