Here's some code I use for testing OP's code where it uses JOptionPane dialog prompts to enter data.
The retVals[] array needs to be filled with the answers for the prompts.
//----------------------------------------------------------- // Following class for testing static class JOptionPane { static String[] retVals = {"cat","felix", "5", "3"}; // the responses to be returned by showInput static int idx = 0; // index to above static public String showInputDialog(Object obj, String msg) { return showInputDialog(msg); } static public String showInputDialog(Object obj, String msg, String t, int i) { return showInputDialog(msg); } static public String showInputDialog(String msg) { System.out.println(msg + " >Return val="+retVals[idx]); return retVals[idx++]; } static public void showMessageDialog(Object obj1, String msg) { System.out.println(msg); } static public void showMessageDialog(Object obj1, Object obj2, String msg, int type) { System.out.println(msg); } static int INFORMATION_MESSAGE = 1; static int QUESTION_MESSAGE = 2; static int ERROR_MESSAGE = 3; } // end JOptionPane class for testing