Пример #1
0
  @Override
  void openFontDialog(String langCode) {
    FontDialog dlg = new FontDialog(this);
    dlg.setAttributes(font);

    Properties prop = new Properties();

    try {
      File xmlFile = new File(baseDir, "data/pangram.xml");
      prop.loadFromXML(new FileInputStream(xmlFile));
      dlg.setPreviewText(prop.getProperty(langCode));
    } catch (IOException ioe) {
      JOptionPane.showMessageDialog(null, ioe.getMessage(), APP_NAME, JOptionPane.ERROR_MESSAGE);
      ioe.printStackTrace();
    } catch (Exception exc) {
      exc.printStackTrace();
    }

    dlg.setVisible(true);
    if (dlg.succeeded()) {
      jTextArea1.setFont(font = dlg.getFont());
      jTextArea1.validate();
    }
  }