What I'm trying to figure out is "How do I make it where if the user hits Cancel on either first or last name, show an error message. ( The one with an X )
Here is my code:
import javax.swing.JOptionPane;
public class Assign2
{
// main method begins execution of Java application
public static void main(String[] args)
{
/* assigned a string called "name" and this will prompt the user to
* input there first name in the dialog box.
*/
String name = JOptionPane.showInputDialog("Please enter your first name:");
/* assigned a string called "name2" and this will prompt the user to
* input there last name in the dialog box.
*/
String name2 = JOptionPane.showInputDialog("Please enter your last name:");
// lastly, this will prompt the user with a welcome message
JOptionPane.showMessageDialog(null, "Hello, " + name + " " + name2 + ",\nWelcome.");
}// end method main
}// end class Assign2