/**
  * Se encarga de armar el dialogo con los requerimientos de un CLiente de banco.
  *
  * @param padre El marco principal de la ventana emergente.
  * @param mensaje El mensaje que lleva la ventana.
  */
 private void armaDialogo(JFrame padre, String mensaje) {
   JPanel panel = new JPanel();
   panel.setLayout(new GridLayout(5, 2));
   panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
   JLabel etiqueta = new JLabel(mensaje, SwingConstants.RIGHT);
   panel.add(etiqueta);
   panel.add(new JLabel(""));
   etiqueta = new JLabel("Nombre:", SwingConstants.RIGHT);
   panel.add(etiqueta);
   inNombre = new JTextField(20);
   panel.add(inNombre);
   etiqueta = new JLabel("RFC:", SwingConstants.RIGHT);
   panel.add(etiqueta);
   inRFC = new JTextField(20);
   panel.add(inRFC);
   etiqueta = new JLabel("Telefono:", SwingConstants.RIGHT);
   panel.add(etiqueta);
   inTelefono = new JTextField(20);
   panel.add(inTelefono);
   aceptar = new JButton("Aceptar");
   cancelar = new JButton("Cancelar");
   panel.add(aceptar);
   panel.add(cancelar);
   getContentPane().add(panel);
   pack();
   inNombre.setRequestFocusEnabled(true);
   inNombre.requestFocus();
   this.setLocationRelativeTo(padre);
 }
  /**
   * Constructor
   *
   * @param aFrame
   */
  public RenameWindow(Frame aFrame) {

    super(aFrame, true);
    setTitle2("Enter a new name");
    setTitle("Rename");
    setBounds(100, 100, 416, 275);

    final JPanel centerPanel = new JPanel();
    centerPanel.setBackground(Color.WHITE);
    final GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.rowHeights = new int[] {0, 7, 7};
    centerPanel.setLayout(gridBagLayout);
    getContentPane().add(centerPanel, BorderLayout.CENTER);

    newName_ = new JTextField();
    newName_.setRequestFocusEnabled(false);
    newName_.setColumns(26);
    final GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridx = 0;
    centerPanel.add(newName_, gridBagConstraints);

    setLocationRelativeTo(aFrame);

    final Component component = Box.createVerticalStrut(5);
    final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
    gridBagConstraints_2.gridy = 1;
    gridBagConstraints_2.gridx = 0;
    centerPanel.add(component, gridBagConstraints_2);

    final JPanel actionPanel = new JPanel();
    actionPanel.setBackground(Color.WHITE);
    final FlowLayout flowLayout_1 = new FlowLayout();
    actionPanel.setLayout(flowLayout_1);
    final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
    gridBagConstraints_1.gridy = 2;
    gridBagConstraints_1.gridx = 0;
    centerPanel.add(actionPanel, gridBagConstraints_1);

    applyButton = new JButton();
    applyButton.setMnemonic(KeyEvent.VK_A);
    applyButton.setSelected(true);
    applyButton.setFont(new Font("Sans", Font.PLAIN, 12));
    applyButton.setText("Apply");
    actionPanel.add(applyButton);

    final Component component_1 = Box.createHorizontalStrut(2);
    actionPanel.add(component_1);

    cancelButton = new JButton();
    cancelButton.setMnemonic(KeyEvent.VK_C);
    cancelButton.setFont(new Font("Sans", Font.PLAIN, 12));
    cancelButton.setText("Cancel");
    actionPanel.add(cancelButton);

    //		GnwGuiSettings settings = GnwGuiSettings.getInstance();
    //		applyButton.setIcon(new ImageIcon(settings.getApplyIconPath()));
    //		cancelButton.setIcon(new ImageIcon(settings.getCancelIconPath()));
  }
  protected void initUI() {

    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();

    setLayout(layout);

    statusField.setFont(textFont);
    statusField.setRequestFocusEnabled(false);
    statusField.setEditable(false);

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    // constraints.weightx = 0.1;
    add(statusField, constraints);

    hostField.setFont(textFont);
    hostField.setRequestFocusEnabled(false);
    hostField.setEditable(false);
    hostField.setText("");

    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 0.5;
    add(hostField, constraints);

    cancelButton.setMaximumSize(new Dimension(20, 20));
    cancelButton.setMinimumSize(new Dimension(20, 20));
    cancelButton.setPreferredSize(new Dimension(20, 20));
    cancelButton.setEnabled(false);
    cancelButton.addActionListener(this);

    constraints.gridx = 2;
    constraints.gridy = 0;
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.PAGE_END;
    add(cancelButton, constraints);

    // setBorder(BorderFactory.createEtchedBorder());

  }
Exemple #4
0
  void constructComponent() {
    // definisikan input text
    m_codeTextField = new JTextField();
    m_codeTextField.setRequestFocusEnabled(false);
    m_custTextField = new JTextField();
    m_custTextField.setEditable(false);
    m_unitTextField = new JTextField();
    m_unitTextField.setEditable(false);
    m_actTextField = new JTextField();
    m_actTextField.setEditable(false);
    m_departTextField = new JTextField();
    m_departTextField.setEditable(false);
    m_wrkdescTextArea = new JTextArea();
    m_wrkdescTextArea.setEditable(false);
    m_wrkdescTextArea.setBackground(Color.lightGray);
    m_wrkdescTextArea.setForeground(Color.black);
    JScrollPane sp = new JScrollPane(m_wrkdescTextArea);
    sp.setPreferredSize(new Dimension(100, 70));

    // definisikan button
    m_codeBt = new JButton("...");
    m_codeBt.addActionListener(this);
    m_codeBt.setPreferredSize(new Dimension(22, 18));

    m_PONoTextField = new JTextField();
    m_PONoTextField.setEditable(false);
    m_IPCNoTextField = new JTextField();
    m_IPCNoTextField.setEditable(false);
    m_PODateTextField = new JTextField();
    m_PODateTextField.setEditable(false);
    m_IPCDateTextField = new JTextField();
    m_IPCDateTextField.setEditable(false);

    // set detail panel
    m_detailPanel = new TimeSheetDetailPanel(m_conn, m_sessionid);

    // definisikan label
    JLabel prjLabel = new JLabel("Project Code*");
    JLabel custLabel = new JLabel("Customer");
    JLabel wrkdescLabel = new JLabel("Work Desc.");
    JLabel unitLabel = new JLabel("Unit Code");
    JLabel actLabel = new JLabel("Activity Code");
    JLabel departLabel = new JLabel("Department");
    JLabel PONoLabel = new JLabel("SO/PO/Contract No.");
    JLabel IPCNoLabel = new JLabel("IPC No.");
    JLabel PODateLabel = new JLabel("SO/PO/Contract Date");
    JLabel IPCDateLabel = new JLabel("IPC Date");

    JPanel leftPanel = new JPanel();
    JPanel rightPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel northrightPanel = new JPanel();

    // left panel
    leftPanel.setLayout(new GridBagLayout());
    GridBagConstraints gridBagConstraints = new GridBagConstraints();

    // project code component
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    leftPanel.add(prjLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    leftPanel.add(new JLabel("   "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    leftPanel.add(m_codeTextField, gridBagConstraints);

    gridBagConstraints.gridx = 3;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.gridwidth = 1;
    gridBagConstraints.insets = new Insets(1, 3, 1, 3);
    leftPanel.add(m_codeBt, gridBagConstraints);

    // customer komponent
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    leftPanel.add(custLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    leftPanel.add(new JLabel("   "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    leftPanel.add(m_custTextField, gridBagConstraints);

    // work desc komponent
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new Insets(2, 0, 1, 2);
    gridBagConstraints.anchor = GridBagConstraints.NORTHEAST;
    leftPanel.add(wrkdescLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    leftPanel.add(new JLabel("   "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    leftPanel.add(sp, gridBagConstraints);

    // northright panel
    northrightPanel.setLayout(new GridBagLayout());
    gridBagConstraints = new GridBagConstraints();

    // unit code komponent
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    northrightPanel.add(unitLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    northrightPanel.add(m_unitTextField, gridBagConstraints);

    // SO/PO/Contract No. komponen
    gridBagConstraints.gridx = 3;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.insets = new Insets(2, 3, 1, 3);
    northrightPanel.add(PONoLabel, gridBagConstraints);

    gridBagConstraints.gridx = 4;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 5;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    northrightPanel.add(m_PONoTextField, gridBagConstraints);

    // activity code komponen
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 1;
    gridBagConstraints.weightx = 0.0;
    northrightPanel.add(actLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    northrightPanel.add(m_actTextField, gridBagConstraints);

    // SO/PO/Contract Date komponen
    gridBagConstraints.gridx = 3;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.insets = new Insets(2, 3, 1, 3);
    northrightPanel.add(PODateLabel, gridBagConstraints);

    gridBagConstraints.gridx = 4;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 5;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    northrightPanel.add(m_PODateTextField, gridBagConstraints);

    // departement komponen
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 1;
    gridBagConstraints.weightx = 0.0;
    northrightPanel.add(departLabel, gridBagConstraints);

    gridBagConstraints.gridx = 1;
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 2;
    gridBagConstraints.weightx = 1.0;
    northrightPanel.add(m_departTextField, gridBagConstraints);

    // IPC No. komponen
    gridBagConstraints.gridx = 3;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.insets = new Insets(2, 3, 1, 3);
    northrightPanel.add(IPCNoLabel, gridBagConstraints);

    gridBagConstraints.gridx = 4;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 5;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    northrightPanel.add(m_IPCNoTextField, gridBagConstraints);

    // IPC Date komponen
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridx = 3;
    gridBagConstraints.weightx = 0.0;
    gridBagConstraints.insets = new Insets(2, 3, 1, 3);
    northrightPanel.add(IPCDateLabel, gridBagConstraints);

    gridBagConstraints.gridx = 4;
    gridBagConstraints.insets = new Insets(2, 0, 1, 0);
    northrightPanel.add(new JLabel(" "), gridBagConstraints);

    gridBagConstraints.gridx = 5;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    northrightPanel.add(m_IPCDateTextField, gridBagConstraints);

    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(northrightPanel, BorderLayout.NORTH);

    northPanel.setLayout(new GridLayout(1, 2, 10, 0));
    northPanel.add(leftPanel);
    northPanel.add(rightPanel);

    setLayout(new BorderLayout(0, 10));
    setBorder(BorderFactory.createEmptyBorder(10, 10, 8, 10));
    add(northPanel, BorderLayout.NORTH);
    add(m_detailPanel, BorderLayout.CENTER);
  }
  private void jbInit() throws Exception {
    this.getContentPane().setLayout(borderLayout1);
    this.setModal(true);
    this.setResizable(true);
    this.setTitle("API Account Settings");
    btnOK.setText("OK");
    btnOK.addActionListener(new DialogAccount_btnOK_actionAdapter(this));

    jPanelUNCredential.setDebugGraphicsOptions(0);
    jPanelUNCredential.setLayout(borderLayout2);
    jPanelTokenCredential.setLayout(borderLayout3);
    jPanel1.setLayout(borderLayout5);
    jPanelUNCHolder.setLayout(borderLayout6);
    jPanelTCHolder.setLayout(borderLayout7);
    jPanelAPIAccount.setLayout(gridLayout1);
    gridLayout1.setColumns(1);
    gridLayout1.setRows(3);
    jLabel1.setPreferredSize(new Dimension(80, 15));
    jLabel1.setText("DeveloperID:");
    jLabel3.setPreferredSize(new Dimension(80, 15));
    jLabel3.setText("Certificate:");
    gridLayout2.setColumns(1);
    gridLayout2.setRows(2);
    jLabel6.setText("Paste your token text or ");
    jPanel10.setLayout(borderLayout4);
    jLabel7.setText("        ");
    jLabel8.setToolTipText("");
    jLabel8.setText("        ");
    txtDeveloperID.setPreferredSize(new Dimension(120, 21));
    txtDeveloperID.setSelectionStart(10);
    txtDeveloperID.setText("");
    txtDeveloperID.addActionListener(new DialogAccount_txtDeveloperID_actionAdapter(this));
    txtCertificate.setPreferredSize(new Dimension(120, 21));
    txtCertificate.setText("");
    jPanelBottom.setLayout(borderLayout8);
    jPanel13.setLayout(gridLayout3);
    gridLayout3.setColumns(1);
    gridLayout3.setRows(3);
    jLabel9.setPreferredSize(new Dimension(90, 15));
    jLabel9.setText("API Server URL:");
    jLabel10.setPreferredSize(new Dimension(90, 15));
    jLabel10.setText("EPS Server URL:");
    txtApiServerUrl.setPreferredSize(new Dimension(280, 21));
    txtApiServerUrl.setText("");
    txtEpsServerUrl.setPreferredSize(new Dimension(280, 21));
    txtEpsServerUrl.setText("http://msa-e1.ebay.com/ws/eBayISAPI.dll?EpsBasicApp");
    txtEpsServerUrl.setColumns(0);
    jPanel16.setLayout(borderLayout9);
    jLabel2.setPreferredSize(new Dimension(80, 15));
    jLabel2.setText("ApplicationID:");
    txtApplicationID.setPreferredSize(new Dimension(120, 21));
    txtApplicationID.setRequestFocusEnabled(true);
    txtApplicationID.setText("");
    txtTokenData.setPreferredSize(new Dimension(50, 200));
    txtSigninUrl.setPreferredSize(new Dimension(280, 21));
    txtSigninUrl.setText("http://my.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn");
    jLabel11.setPreferredSize(new Dimension(90, 15));
    jLabel11.setText("Sign-In URL:");
    jPanel13.setBorder(BorderFactory.createEtchedBorder());
    jScrollPane1.setPreferredSize(new Dimension(54, 40));
    btnCancel.setToolTipText("");
    btnCancel.setText("Cancel");
    btnCancel.addActionListener(new DialogAccount_btnCancel_actionAdapter(this));
    jPanelChoices.setLayout(borderLayout10);
    btnFetchToken.setText("Generate a New Token");
    btnFetchToken.addActionListener(new DialogAccount_btnFetchToken_actionAdapter(this));
    jPanel10.setPreferredSize(new Dimension(102, 40));
    jPanel16.setPreferredSize(new Dimension(400, 480));
    jPanelTokenCredential.setBorder(BorderFactory.createEtchedBorder());
    jPanelApiCredentials.setBorder(BorderFactory.createEtchedBorder());
    jPanelAppId.add(jLabel2, null);
    jPanelAppId.add(txtApplicationID, null);
    this.getContentPane().add(jPanelBottom, BorderLayout.SOUTH);
    jPanel10.add(jLabel7, BorderLayout.WEST);
    jPanel10.add(jLabel8, BorderLayout.EAST);
    jPanel10.add(jScrollPane1, BorderLayout.CENTER);
    jPanel16.add(jPanel13, BorderLayout.SOUTH);
    jScrollPane1.getViewport().add(txtTokenData, null);
    jPanelTokenCredential.add(jPanel11, BorderLayout.NORTH);
    jPanel11.add(jLabel6, null);
    jPanel11.add(btnFetchToken, null);
    jPanelTokenCredential.add(jPanel10, BorderLayout.CENTER);
    jPanelTCHolder.add(jPanelTokenCredential, BorderLayout.CENTER);
    this.getContentPane().add(jPanel16, BorderLayout.CENTER);
    jPanelDevId.add(jLabel1, null);
    jPanelDevId.add(txtDeveloperID, null);
    jPanelAPIAccount.add(jPanelDevId, null);
    jPanelCertificate.add(jLabel3, null);
    jPanelCertificate.add(txtCertificate, null);
    jPanel16.add(jPanelChoices, BorderLayout.CENTER);
    jPanelChoices.add(jPanelUNCHolder, BorderLayout.NORTH);
    jPanelAPIAccount.add(jPanelAppId, null);
    jPanelAPIAccount.add(jPanelCertificate, null);
    jPanelUNCHolder.add(jPanelUNCredential, BorderLayout.CENTER);
    jPanel16.add(jPanelApiCredentials, BorderLayout.NORTH);
    jPanelApiCredentials.add(jPanelAPIAccount, null);
    jPanelUNCredential.add(jPanel1, BorderLayout.SOUTH);
    jPanelChoices.add(jPanelTCHolder, BorderLayout.CENTER);
    jPanelBottom.add(jPanel12, BorderLayout.SOUTH);
    jPanel12.add(btnOK, null);
    jPanel12.add(btnCancel, null);
    jPanelApiServer.add(jLabel9, null);
    jPanelApiServer.add(txtApiServerUrl, null);
    jPanel13.add(jPanelEpsServer, null);
    jPanel13.add(jPanelApiServer, null);
    jPanelEpsServer.add(jLabel10, null);
    jPanelEpsServer.add(txtEpsServerUrl, null);
    jPanel13.add(jPanelSignInUrl, null);
    jPanelSignInUrl.add(jLabel11, null);
    jPanelSignInUrl.add(txtSigninUrl, null);
  }
  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();
  }
  public void mouseClicked(MouseEvent e) {

    list.setSelectedIndex(-1);
    list.setRequestFocusEnabled(false);
    // changedField = null;

    if (selComp == text || selComp == text2) {
      selComp.setBackground(Color.WHITE);
      ((JTextField) selComp).setEditable(false);
      ((JTextField) selComp).getCaret().setVisible(false);
    }

    text2.setBackground(Color.WHITE);
    // cBox.repaint();

    if (selComp instanceof MyButton) {
      ((MyButton) selComp).setSelected(false);
      ((MyButton) selComp).setFocusable(false);
    }

    selComp = (Component) e.getSource();

    if (selComp == text || selComp == text2) {

      ((JTextField) selComp).setRequestFocusEnabled(true);

      selComp.setBackground(vLightBlue);
      ((JTextField) selComp).getCaret().setVisible(true);
      ((JTextField) selComp).setEditable(true);
      // ((JTextField) selComp).requestFocusInWindow();

    }

    if (e.getSource() instanceof JList) {
      selComp = list;
      int rowNo = list.locationToIndex(e.getPoint());
      if (rowNo == -1) return;

      list.setRequestFocusEnabled(true);

      list.setSelectedIndex(rowNo);
      text.setBackground(Color.WHITE);
      // text2.setBackground(textBackground);

      // http://stackoverflow.com/questions/16392212/unable-to-type-or-delete-text-in-jtextfield
      // http://stackoverflow.com/questions/13415150/java-swing-form-and-cannot-type-text-in-newly-added-jtextfield
      // (this says don't use keylistener!)
      //		http://stackoverflow.com/questions/22642401/jtextfield-and-keylistener-java-swing?rq=1
      //		textField.getDocument().addDocumentListener(...);
      // new code

      // text2.requestFocusInWindow();
      // text2.setBackground(vLightBlue);
      // text2.getCaret().setVisible(true);

      // String fn = listHead + File.separator + nodeNames[rowNo];

      if (e.getClickCount() == 1) {
        mLoc = e.getLocationOnScreen();

        if (nodeNames[rowNo].equals("(empty folder")) return;

      } else if (e.getClickCount() == 2) {

        Point p = e.getLocationOnScreen();

        if (mLoc != null && Math.abs(p.x - mLoc.x) < 6 && Math.abs(p.y - mLoc.y) < 6) {

          enterAction.actionPerformed(new ActionEvent(e, 0, ""));
        }
      }
    }

    if (selComp == cBox) {
      selComp.setFocusable(true);
      cBox.requestFocusInWindow();
      cBox.setEnabled(true);
      cBox.setBackground(vLightBlue);
    }

    if (selComp instanceof MyButton) {
      ((MyButton) selComp).setSelected(false);
    }
    paintList();
    list.repaint();
  }