code: public int getSelectedFontSize() {
          int fontSize = 1;
          String fontSizeString = getFontSizeTextField().getText();
          while (true) {
              try {
                  fontSize = Integer.parseInt(fontSizeString);
                  break;
              } catch (NumberFormatException e) {
                  fontSizeString = (String) getFontSizeList().getSelectedValue();
                  getFontSizeTextField().setText(fontSizeString);
              }
          }
  
          return fontSize;
      }
docs: Get the size of the selected font.
  @return  the size of the selected font
  
  @see #setSelectedFontSize