Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JOptionPane.showInputDialog()

843806Mar 10 2008 — edited Mar 11 2008
why does my program give me a NullPointerException when i press the CANCEL button? what can i do to make it close down the dialog when the cancel buttong is pressed?

thank you
Hristo
private String promptForSchoolName()
{
	String name = "";

	while(name.length() == 0)
	{
		name = JOptionPane.showInputDialog("Enter school name:");

		if(name.length() == 0)
		{
			JOptionPane.showMessageDialog(null, "Invalid input.");
		}
	}
	return name;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2008
Added on Mar 10 2008
11 comments
790 views