Simple, you use the Integer.parseInt() method.
String stroption = JOptionPane.showInputDialog(null, menu, "Choose an Option:", JOptionPane.QUESTION_MESSAGE);
int option = Integer.parseInt(stroption);
If you really want to get fancy to avoid any error, use a try catch statement:
String stroption = JOptionPane.showInputDialog(null, menu, "Choose an Option:", JOptionPane.QUESTION_MESSAGE);
int option;
try
{
option = Integer.parseInt(stroption);
}
catch(Exception E)
{
option = 0;
}
And life is good....