private void initComponents() {
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setTitle(I18n.getLocaleString("SETTINGS"));
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            formWindowClosing(evt);
          }
        });

    maxParallelDownloadsLabel = new JLabel(I18n.getLocaleString("MAX_PARALLEL_DOWNLOADS"));
    maxParallelDownloadsLabel.setFont(
        new Font(maxParallelDownloadsLabel.getFont().getName(), Font.BOLD, 11));

    downloadDirectoryLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_DIRECTORY"));
    downloadDirectoryLabel.setFont(
        new Font(downloadDirectoryLabel.getFont().getName(), Font.BOLD, 11));

    downloadDirectoryTextField = new JTextField();
    downloadDirectoryTextField.setRequestFocusEnabled(false);

    maxParallelDownloadsSpinner = new JSpinner();
    maxParallelDownloadsSpinner.setModel(new SpinnerNumberModel(10, 1, null, 1));
    maxParallelDownloadsSpinner.setValue(10);

    saveSettingsButton = new JButton(I18n.getLocaleString("SAVE_AND_CLOSE"));
    saveSettingsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            saveSettingsButtonActionPerformed(evt);
          }
        });

    downloadDirectoryButton = new JButton("...");
    downloadDirectoryButton.setFocusable(false);
    downloadDirectoryButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            downloadDirectoryButtonActionPerformed(evt);
          }
        });

    fileNameSchemeTextField = new JTextField();
    fileNameSchemeTextField.setFont(new Font(Font.MONOSPACED, 0, 12));

    filenameSchemeLabel = new JLabel(I18n.getLocaleString("FILENAME_SCHEME"));
    filenameSchemeLabel.setFont(new Font(filenameSchemeLabel.getFont().getName(), Font.BOLD, 11));

    filenameSchemeDescriptionLabel = new JLabel();
    filenameSchemeDescriptionLabel.setFont(
        new Font(filenameSchemeDescriptionLabel.getFont().getName(), Font.PLAIN, 11));
    filenameSchemeDescriptionLabel.setLabelFor(fileNameSchemeTextField);
    String tagStyle = "font-family: Monospaced; font-weight: bold;";
    filenameSchemeDescriptionLabel.setText(
        "<html><body>"
            + I18n.getLocaleString("FILENAME_SCHEME_DESCRIPTION")
                .replace("&lt;", "<span style=\"" + tagStyle + "\">&lt;")
                .replace("&gt;", "&gt;</span>")
                .replaceFirst("/", "<span style=\"" + tagStyle + "\">/</span>")
            + "</body></html>");

    /*searchAutocompleteLabel = new JLabel(I18n.getLocaleString("SEARCH_AUTOCOMPLETE"));
    searchAutocompleteLabel.setFont(new Font(searchAutocompleteLabel.getFont().getName(), Font.BOLD, 11));

    searchAutocompleteCheckBox = new JCheckBox(I18n.getLocaleString("ENABLED"));
    searchAutocompleteCheckBox.setFont(new Font(searchAutocompleteCheckBox.getFont().getName(), Font.BOLD, 11));*/

    startTabLabel = new JLabel(I18n.getLocaleString("START_TAB"));
    startTabLabel.setFont(new Font(startTabLabel.getFont().getName(), Font.BOLD, 11));

    startTabComboBox = new JComboBox();

    downloadCompletedLabel = new JLabel(I18n.getLocaleString("DOWNLOAD_COMPLETED"));
    downloadCompletedLabel.setFont(
        new Font(downloadCompletedLabel.getFont().getName(), Font.BOLD, 11));

    downloadCompletedComboBox = new JComboBox();

    languageLabel = new JLabel(I18n.getLocaleString("LANGUAGE"));
    languageLabel.setFont(new Font(languageLabel.getFont().getName(), Font.BOLD, 11));

    languageComboBox = new JComboBox();
    DefaultComboBoxModel languageComboBoxModel = new DefaultComboBoxModel();
    languageComboBox.setModel(languageComboBoxModel);
    for (Locale locale : I18n.getLocales()) {
      languageComboBoxModel.addElement(locale);
      if (locale.equals(I18n.getCurrentLocale())) {
        languageComboBox.setSelectedItem(locale);
      }
    }
    languageComboBox.setRenderer(
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Component comp =
                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            JLabel label = new JLabel();
            label.setOpaque(false);
            if (isSelected) {
              label.setOpaque(true);
              label.setForeground(comp.getForeground());
              label.setBackground(comp.getBackground());
            } else {
              label.setBackground(comp.getBackground());
            }
            label.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 6));
            list.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
            list.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

            Locale locale = (Locale) value;

            String languageNameForeign = WordUtils.capitalize(locale.getDisplayName(locale));
            String languageNameOwn =
                WordUtils.capitalize(locale.getDisplayName(I18n.getCurrentLocale()));
            String languageCode = locale.toString().replace("_", "-");

            // fix not existent language names
            if (locale.toString().equals("en_PT")) {
              languageNameForeign = "Pirate English";
              languageNameOwn = languageNameForeign;
            }
            if (locale.toString().equals("lol")) {
              languageNameForeign = "LOLCAT";
              languageNameOwn = languageNameForeign;
            }

            // fix ISO3 codes
            if (locale.toString().equals("iw")) {
              languageCode = "he";
            }

            URL url = getClass().getResource("/gui/flags/" + languageCode + ".png");
            if (url != null) {
              ImageIcon icon = new ImageIcon(url);
              icon = GuiUtils.stretchImage(icon, 18, 18, this);
              label.setIcon(icon);
            }

            label.setText(
                "<html>"
                    + "\u202A"
                    + languageNameForeign
                    + (!isSelected ? "<font color=gray>" : "")
                    + " — "
                    + languageNameOwn
                    + (!isSelected ? "</font>" : "")
                    + "</html>");

            return label;
          }
        });

    resetOriginalSettingsButton = new JButton(I18n.getLocaleString("RESET_ORIGINAL_SETTINGS"));
    resetOriginalSettingsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            resetOriginalSettingsButtonActionPerformed(evt);
          }
        });

    fileExistsLabel = new JLabel();
    fileExistsLabel.setFont(new Font(fileExistsLabel.getFont().getName(), Font.BOLD, 11));
    fileExistsLabel.setText(I18n.getLocaleString("FILE_EXISTS"));

    fileExistsComboBox = new JComboBox();

    proxyHostLabel = new JLabel(I18n.getLocaleString("PROXY_HOST"));
    proxyHostLabel.setFont(new Font(proxyHostLabel.getFont().getName(), Font.BOLD, 11));

    proxyHostTextField = new JTextField();

    proxyPortLabel = new JLabel(I18n.getLocaleString("PROXY_PORT"));
    proxyPortLabel.setFont(new Font(proxyPortLabel.getFont().getName(), Font.BOLD, 11));

    proxyPortTextField = new JTextField();

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.LEADING)
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(
                                        resetOriginalSettingsButton,
                                        GroupLayout.PREFERRED_SIZE,
                                        227,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(LayoutStyle.RELATED)
                                    .add(
                                        saveSettingsButton,
                                        GroupLayout.PREFERRED_SIZE,
                                        250,
                                        GroupLayout.PREFERRED_SIZE))
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(
                                        layout
                                            .createParallelGroup(GroupLayout.TRAILING, false)
                                            .add(
                                                languageLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                fileExistsLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                maxParallelDownloadsLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                filenameSchemeLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                downloadDirectoryLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                startTabLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                downloadCompletedLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                proxyHostLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .add(
                                                proxyPortLabel,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE))
                                    .addPreferredGap(LayoutStyle.RELATED)
                                    .add(
                                        layout
                                            .createParallelGroup(GroupLayout.LEADING)
                                            .add(
                                                layout
                                                    .createSequentialGroup()
                                                    .add(downloadDirectoryTextField)
                                                    .addPreferredGap(LayoutStyle.RELATED)
                                                    .add(
                                                        downloadDirectoryButton,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        48,
                                                        GroupLayout.PREFERRED_SIZE))
                                            .add(
                                                GroupLayout.TRAILING,
                                                filenameSchemeDescriptionLabel,
                                                GroupLayout.PREFERRED_SIZE,
                                                0,
                                                Short.MAX_VALUE)
                                            .add(GroupLayout.TRAILING, fileNameSchemeTextField)
                                            .add(
                                                layout
                                                    .createSequentialGroup()
                                                    .add(
                                                        layout
                                                            .createParallelGroup(
                                                                GroupLayout.LEADING, false)
                                                            .add(
                                                                downloadCompletedComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(startTabComboBox)
                                                            .add(
                                                                maxParallelDownloadsSpinner,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                60,
                                                                GroupLayout.PREFERRED_SIZE)
                                                            .add(
                                                                fileExistsComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(
                                                                languageComboBox,
                                                                0,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .add(proxyHostTextField)
                                                            .add(proxyPortTextField))
                                                    .add(0, 0, Short.MAX_VALUE)))))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                downloadDirectoryTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)
                            .add(downloadDirectoryButton)
                            .add(
                                downloadDirectoryLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.UNRELATED)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.LEADING, false)
                            .add(maxParallelDownloadsSpinner)
                            .add(
                                maxParallelDownloadsLabel,
                                GroupLayout.PREFERRED_SIZE,
                                20,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                filenameSchemeLabel,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                fileNameSchemeTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.RELATED)
                    .add(
                        filenameSchemeDescriptionLabel,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.UNRELATED)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(
                                startTabLabel,
                                GroupLayout.PREFERRED_SIZE,
                                23,
                                GroupLayout.PREFERRED_SIZE)
                            .add(startTabComboBox))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(downloadCompletedLabel)
                            .add(
                                downloadCompletedComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(15, 15, 15)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(fileExistsLabel)
                            .add(
                                fileExistsComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(languageLabel)
                            .add(
                                languageComboBox,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(proxyHostLabel)
                            .add(
                                proxyHostTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(proxyPortLabel)
                            .add(
                                proxyPortTextField,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .add(50, 50, 50)
                    .add(
                        layout
                            .createParallelGroup(GroupLayout.BASELINE)
                            .add(saveSettingsButton)
                            .add(resetOriginalSettingsButton))
                    .addContainerGap()));

    setMinimumSize(new Dimension(700, 620));

    pack();
  }