First in Init method you initialize i with 1 , please initialize it with 0 . . .
Secondly JOptionPane only give and take
String
like
String input = JOPtionPane.showInputDialog("Enter String");
JOptionPane.showMessageDialog(null , "input");
if you use input string as a integer yoy should use parsing ,,.. like int in = Integer.parseInt(input);
moreover you use
java documentations for more help