Hello i'm new to java and i would like to ask some question regarding JOptionPane.showinput so that it will only accept letters/numbers only and if they enter an incorrect one it will result to an error and need to retype again (searched the site for some solution but they don't work on my code i don't know why) And lastly i was planning to multiple choices on my joptionpane but when i typed icon it got registered as an error heres my code
JFrame frame = new JFrame("Student Record");
JOptionPane.showMessageDialog(frame,
"Welcome to the School's Student Grade Record!");
System.out.println("School's Student Grade Record");
String name;
name = JOptionPane.showInputDialog(frame,"Enter the name of the student");
System.out.println("The name of the student is: "+name);
Object[] choices = {"Filipino", "Math", "English"};
String grade = (String)JOptionPane.showInputDialog(frame,
"What grade subject do you choose to input?\"","Customized Dialog",
JOptionPane.PLAIN_MESSAGE,icon,choices,"Math");
System.exit(0);