Example usage for javax.swing JFileChooser setMultiSelectionEnabled

List of usage examples for javax.swing JFileChooser setMultiSelectionEnabled

Introduction

In this page you can find the example usage for javax.swing JFileChooser setMultiSelectionEnabled.

Prototype

@BeanProperty(description = "Sets multiple file selection mode.")
public void setMultiSelectionEnabled(boolean b) 

Source Link

Document

Sets the file chooser to allow multiple file selections.

Usage

From source file:org.kse.gui.crypto.DUpgradeCryptoStrength.java

private void browsePolicyPressed() {
    JFileChooser chooser = FileChooserFactory.getZipFileChooser();

    chooser.setCurrentDirectory(CurrentDirectory.get());

    chooser.setDialogTitle(res.getString("DUpgradeCryptoStrength.Title.ChoosePolicyZip.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this,
            res.getString("DUpgradeCryptoStrength.Title.PolicyZipChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();

        if (!chosenFile.isFile()) {
            JOptionPane.showMessageDialog(DUpgradeCryptoStrength.this,
                    res.getString("DUpgradeCryptoStrength.NotPolicyZip.message"),
                    res.getString("DUpgradeCryptoStrength.Title"), JOptionPane.WARNING_MESSAGE);
            return;
        }//from   w ww.j a  va 2  s  . co  m

        processPolicyZipFile(chosenFile);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairOpenSsl.java

private void privateKeyBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getOpenSslPvkFileChooser();

    File currentFile = new File(jtfPrivateKeyPath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {//from ww  w  .  j a  v  a2  s . c  om
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairOpenSsl.ChoosePrivateKey.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this,
            res.getString("DImportKeyPairOpenSsl.PrivateKeyFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfPrivateKeyPath.setText(chosenFile.toString());
        jtfPrivateKeyPath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairOpenSsl.java

private void certificateBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getCertFileChooser();

    File currentFile = new File(jtfCertificatePath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {/*  w  w w .j a  v a2  s  . co m*/
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairOpenSsl.ChooseCertificate.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this,
            res.getString("DImportKeyPairOpenSsl.CertificateFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfCertificatePath.setText(chosenFile.toString());
        jtfCertificatePath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairPkcs8.java

private void privateKeyBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getPkcs8FileChooser();

    File currentFile = new File(jtfPrivateKeyPath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {//from w  ww .j a  v a2  s .  c o  m
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairPkcs8.ChoosePrivateKey.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DImportKeyPairPkcs8.PrivateKeyFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfPrivateKeyPath.setText(chosenFile.toString());
        jtfPrivateKeyPath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairPkcs8.java

private void certificateBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getCertFileChooser();

    File currentFile = new File(jtfCertificatePath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {/*from  ww w  .j  a v  a2s  . c o  m*/
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairPkcs8.ChooseCertificate.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DImportKeyPairPkcs8.CertificateFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfCertificatePath.setText(chosenFile.toString());
        jtfCertificatePath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairPvk.java

private void privateKeyBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getPvkFileChooser();

    File currentFile = new File(jtfPrivateKeyPath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {//from  w  w  w  .  j  a  v a  2  s  . c  om
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairPvk.ChoosePrivateKey.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DImportKeyPairPvk.PrivateKeyFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfPrivateKeyPath.setText(chosenFile.toString());
        jtfPrivateKeyPath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.importexport.DImportKeyPairPvk.java

private void certificateBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getCertFileChooser();

    File currentFile = new File(jtfCertificatePath.getText());

    if ((currentFile.getParentFile() != null) && (currentFile.getParentFile().exists())) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
    } else {/*from   w  w  w.  j ava2s  .com*/
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DImportKeyPairPvk.ChooseCertificate.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DImportKeyPairPvk.CertificateFileChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfCertificatePath.setText(chosenFile.toString());
        jtfCertificatePath.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.sign.DSignJar.java

private void inputJarBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getArchiveFileChooser();

    File currentFile = new File(jtfInputJar.getText().trim());

    if (currentFile.getParentFile() != null && currentFile.getParentFile().exists()) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
        chooser.setSelectedFile(currentFile);
    } else {//from w  ww.  j  av  a  2s.c  om
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DSignJar.ChooseInputJar.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DSignJar.InputJarChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfInputJar.setText(chosenFile.toString());
        jtfInputJar.setCaretPosition(0);
        populateOutputJarFileName(chosenFile);
    }
}

From source file:org.kse.gui.dialogs.sign.DSignJar.java

private void outputJarBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getArchiveFileChooser();

    File currentFile = new File(jtfOutputJar.getText());

    if (currentFile.getParentFile() != null && currentFile.getParentFile().exists()) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
        chooser.setSelectedFile(currentFile);
    } else {/*from  w w  w . j ava2  s. c  o m*/
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DSignJar.ChooseOutputJar.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = JavaFXFileChooser.isFxAvailable() ? chooser.showSaveDialog(this)
            : chooser.showDialog(this, res.getString("DSignJar.OutputJarChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfOutputJar.setText(chosenFile.toString());
        jtfOutputJar.setCaretPosition(0);
    }
}

From source file:org.kse.gui.dialogs.sign.DSignMidlet.java

private void inputJadBrowsePressed() {
    JFileChooser chooser = FileChooserFactory.getJadFileChooser();

    File currentFile = new File(jtfInputJad.getText());

    if (currentFile.getParentFile() != null && currentFile.getParentFile().exists()) {
        chooser.setCurrentDirectory(currentFile.getParentFile());
        chooser.setSelectedFile(currentFile);
    } else {/*from ww w  .  j a v  a2  s .co m*/
        chooser.setCurrentDirectory(CurrentDirectory.get());
    }

    chooser.setDialogTitle(res.getString("DSignMidlet.ChooseInputJad.Title"));

    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(this, res.getString("DSignMidlet.InputJadChooser.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(chosenFile);
        jtfInputJad.setText(chosenFile.toString());
        jtfInputJad.setCaretPosition(0);
        populateOutputJadFileName(chosenFile);
    }
}