// DialogInitials.java
// Ch. 5, p. 150

import javax.swing.*;

public class DialogInitials
{

	public static void main(String[] args)
	{
		String response = JOptionPane.showInputDialog(null,
						  "Enter Intials",
						  "Please enter three initials:",
						  JOptionPane.INFORMATION_MESSAGE
						  );
		if((response == null)||(response.length() != 3)
		||(response.charAt(0)<'A')||(response.charAt(0)>'Z'))
			response = JOptionPane.showInputDialog(null,
						  "HELLO! - Try Again!\nPlease enter THREE initials, with no periods or spaces:");
		JOptionPane.showMessageDialog(null, response);
		int option = JOptionPane.showConfirmDialog(null, "Are the initials correct?");
		if (option == 1)
			JOptionPane.showMessageDialog(null,"Sorry...");
		System.exit(0);
	}
}
