if(name.equals(null) || lastname.equals(null))
JOptionPane.showMessageDialog(null, "Sorry, you have to enter your name to enroll into CIS 226.", "Error ", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(null, "Sorry, you have to enter your name to enroll into CIS 226.", "Error ", JOptionPane.ERROR_MESSAGE);

}

}

February 8th, 2011, 05:02 AM

DanBrown

Re: Need help with If the user hits Cancel on either first or last name, show the err

Quote:

//For extra credit

if(name.equals(null) || lastname.equals(null))
JOptionPane.showMessageDialog(null, "Sorry, you have to enter your name to enroll into CIS 226.", "Error ", JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(null, "Sorry, you have to enter your name to enroll into CIS 226.", "Error ", JOptionPane.ERROR_MESSAGE);

}

you haven't seen the code i had given earlier carefully, welcome message should be in else part.

Quote:

if(name.equals(null) || lastname.equals(null))
JOptionPane.showMessageDialog(null, "Sorry, you have to enter your name to enroll into CIS 226.", "Error ", JOptionPane.ERROR_MESSAGE);