I'm trying to create a method that validates that the user did not leave the JTextField empty. No error handling is needed, I just need to make sure it is not empty and the user entered the number of meals. I wrote the following:
private void validateMeals()
{
if(mealsField.getText() == "")
{
JOptionPane.showMessageDialog(null,"You must enter number of meals",
"Rocky Jonhs Management System", JOptionPane.ERROR_MESSAGE);
mealsField.setText("");
}
nameField.requestFocus();
} //end validateMeals() method