String input = JOptionPane.showInputDialog("How old are you?");
if (input != null) age = Integer.parseInt(input);