Reading Input From a Dialog Box
- String input = JOptionPane.showInputDialog(prompt)
- Convert strings to numbers if necessary:
int count = Integer.parseInt(input);
- Conversion throws an exception if user doesn't supply a
number–see chapter 15
- Add System.exit(0) to the main method of any
program that uses JOptionPane