public void actionPerformed(ActionEvent e) {
   if (e.getSource() == submit) {
     if (rb1.isSelected()) {
       JFrame frame = Application.getFrame();
       if (typeCodes.isEmpty()) {
         JOptionPane.showMessageDialog(
             frame,
             "Please select at least one toponym type.",
             "Error",
             JOptionPane.ERROR_MESSAGE);
       } else {
         Application.getMainCitiesPanel(this, typeCodes, 0, 0.0);
       }
     } else if (rb2.isSelected()) {
       JFrame frame = Application.getFrame();
       try {
         nCities = new Integer(nCitiesField.getText());
         if (nCities <= 0) throw new NumberFormatException();
         typeCodes = new ArrayList<String>();
         Application.getMainCitiesPanel(this, typeCodes, nCities, 0.0);
       } catch (NumberFormatException ex) {
         JOptionPane.showMessageDialog(
             frame, "Please enter a positive integer number.", "Error", JOptionPane.ERROR_MESSAGE);
       }
     } else {
       JFrame frame = Application.getFrame();
       try {
         Double dist = new Double(distField.getText());
         if (dist <= 0) throw new NumberFormatException();
         typeCodes = new ArrayList<String>();
         Application.getMainCitiesPanel(this, typeCodes, 0, dist);
       } catch (NumberFormatException ex) {
         JOptionPane.showMessageDialog(
             frame, "Please enter a positive number.", "Error", JOptionPane.ERROR_MESSAGE);
       }
     }
   } else {
     Application.getOptionPanel(this, countryName);
   }
 }