/** Allows subclasses to modify the chooser to suit their needs. */
  protected JFileChooser createFileChooser() {
    File originalFile = (File) getValue();

    final JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(mode);
    if (originalFile != null && originalFile.getParent() != null)
      chooser.setCurrentDirectory(new File(originalFile.getParent()));
    chooser.setSelectedFile(originalFile);
    chooser.setApproveButtonText(bundle.getString("CTL_ApproveSelect"));
    chooser.setApproveButtonToolTipText(bundle.getString("CTL_ApproveSelectToolTip"));
    switch (mode) {
      case JFileChooser.FILES_AND_DIRECTORIES:
        chooser.setDialogTitle(bundle.getString("CTL_DialogTitleFilesAndDirs"));
        break;
      case JFileChooser.FILES_ONLY:
        chooser.setDialogTitle(bundle.getString("CTL_DialogTitleFiles"));
        break;
      case JFileChooser.DIRECTORIES_ONLY:
        chooser.setDialogTitle(bundle.getString("CTL_DialogTitleDirs"));
        break;
    }

    return chooser;
  }
示例#2
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    configSep = new javax.swing.JSeparator();
    configPanel = new javax.swing.JPanel();
    configLabel = new javax.swing.JLabel();
    configCombo = new javax.swing.JComboBox();
    configNew = new javax.swing.JButton();
    configDel = new javax.swing.JButton();
    mainPanel = new javax.swing.JPanel();
    jLabelMainClass = new javax.swing.JLabel();
    jTextFieldMainClass = new javax.swing.JTextField();
    jButtonMainClass = new javax.swing.JButton();
    jLabelArgs = new javax.swing.JLabel();
    jTextFieldArgs = new javax.swing.JTextField();
    jLabelWorkingDirectory = new javax.swing.JLabel();
    jTextWorkingDirectory = new javax.swing.JTextField();
    jButtonWorkingDirectoryBrowse = new javax.swing.JButton();
    jLabelVMOptions = new javax.swing.JLabel();
    jTextVMOptions = new javax.swing.JTextField();
    jLabelVMOptionsExample = new javax.swing.JLabel();
    customizeOptionsButton = new javax.swing.JButton();
    extPanel = new javax.swing.JPanel();

    setLayout(new java.awt.GridBagLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
    add(configSep, gridBagConstraints);

    configPanel.setLayout(new java.awt.GridBagLayout());

    configLabel.setLabelFor(configCombo);
    org.openide.awt.Mnemonics.setLocalizedText(
        configLabel,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "CustomizerRun.configLabel")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
    configPanel.add(configLabel, gridBagConstraints);
    configLabel
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getMessage(
                CustomizerRun.class, "AD_CustomizerRun_Cfg")); // NOI18N

    configCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"<default>"}));
    configCombo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            configComboActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0);
    configPanel.add(configCombo, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(
        configNew,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "CustomizerRun.configNew")); // NOI18N
    configNew.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            configNewActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0);
    configPanel.add(configNew, gridBagConstraints);
    configNew
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getMessage(
                CustomizerRun.class, "AD_CustomizerRun_NewCfg")); // NOI18N

    org.openide.awt.Mnemonics.setLocalizedText(
        configDel,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "CustomizerRun.configDelete")); // NOI18N
    configDel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            configDelActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0);
    configPanel.add(configDel, gridBagConstraints);
    configDel
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getMessage(
                CustomizerRun.class, "AD_CustomizerRun_DeleteCfg")); // NOI18N

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
    add(configPanel, gridBagConstraints);

    mainPanel.setLayout(new java.awt.GridBagLayout());

    jLabelMainClass.setLabelFor(jTextFieldMainClass);
    org.openide.awt.Mnemonics.setLocalizedText(
        jLabelMainClass,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_MainClass_JLabel")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
    mainPanel.add(jLabelMainClass, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0);
    mainPanel.add(jTextFieldMainClass, gridBagConstraints);
    jTextFieldMainClass
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getBundle(CustomizerRun.class)
                .getString("AD_jTextFieldMainClass")); // NOI18N

    org.openide.awt.Mnemonics.setLocalizedText(
        jButtonMainClass,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_MainClass_JButton")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 5, 0);
    mainPanel.add(jButtonMainClass, gridBagConstraints);
    jButtonMainClass
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getBundle(CustomizerRun.class)
                .getString("AD_jButtonMainClass")); // NOI18N

    jLabelArgs.setLabelFor(jTextFieldArgs);
    org.openide.awt.Mnemonics.setLocalizedText(
        jLabelArgs,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_Args_JLabel")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
    mainPanel.add(jLabelArgs, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
    mainPanel.add(jTextFieldArgs, gridBagConstraints);
    jTextFieldArgs
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getBundle(CustomizerRun.class)
                .getString("AD_jTextFieldArgs")); // NOI18N

    jLabelWorkingDirectory.setLabelFor(jTextWorkingDirectory);
    org.openide.awt.Mnemonics.setLocalizedText(
        jLabelWorkingDirectory,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_Working_Directory")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
    mainPanel.add(jLabelWorkingDirectory, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0);
    mainPanel.add(jTextWorkingDirectory, gridBagConstraints);
    java.util.ResourceBundle bundle =
        java.util.ResourceBundle.getBundle(
            "org/netbeans/modules/java/j2seproject/ui/customizer/Bundle"); // NOI18N
    jTextWorkingDirectory
        .getAccessibleContext()
        .setAccessibleDescription(
            bundle.getString("AD_CustomizeRun_Run_Working_Directory ")); // NOI18N

    org.openide.awt.Mnemonics.setLocalizedText(
        jButtonWorkingDirectoryBrowse,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_Working_Directory_Browse")); // NOI18N
    jButtonWorkingDirectoryBrowse.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonWorkingDirectoryBrowseActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 5, 0);
    mainPanel.add(jButtonWorkingDirectoryBrowse, gridBagConstraints);
    jButtonWorkingDirectoryBrowse
        .getAccessibleContext()
        .setAccessibleDescription(
            bundle.getString("AD_CustomizeRun_Run_Working_Directory_Browse")); // NOI18N

    jLabelVMOptions.setLabelFor(jTextVMOptions);
    org.openide.awt.Mnemonics.setLocalizedText(
        jLabelVMOptions,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_VM_Options")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
    mainPanel.add(jLabelVMOptions, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
    mainPanel.add(jTextVMOptions, gridBagConstraints);
    jTextVMOptions
        .getAccessibleContext()
        .setAccessibleDescription(bundle.getString("AD_CustomizeRun_Run_VM_Options")); // NOI18N

    jLabelVMOptionsExample.setLabelFor(jTextFieldMainClass);
    org.openide.awt.Mnemonics.setLocalizedText(
        jLabelVMOptionsExample,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_VM_Options_Example")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
    mainPanel.add(jLabelVMOptionsExample, gridBagConstraints);
    jLabelVMOptionsExample
        .getAccessibleContext()
        .setAccessibleDescription(
            bundle.getString("LBL_CustomizeRun_Run_VM_Options_Example")); // NOI18N

    org.openide.awt.Mnemonics.setLocalizedText(
        customizeOptionsButton,
        org.openide.util.NbBundle.getMessage(
            CustomizerRun.class, "LBL_CustomizeRun_Run_VM_Options_JButton")); // NOI18N
    customizeOptionsButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            customizeVMOptionsByDialog(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
    mainPanel.add(customizeOptionsButton, gridBagConstraints);
    customizeOptionsButton
        .getAccessibleContext()
        .setAccessibleName(
            org.openide.util.NbBundle.getMessage(
                CustomizerRun.class, "AN_CustomizeRun_Run_VM_Options_JButton")); // NOI18N
    customizeOptionsButton
        .getAccessibleContext()
        .setAccessibleDescription(
            org.openide.util.NbBundle.getMessage(
                CustomizerRun.class, "AD_CustomizeRun_Run_VM_Options_Customize")); // NOI18N

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0);
    add(mainPanel, gridBagConstraints);

    extPanel.setLayout(new java.awt.GridBagLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(extPanel, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents