Example usage for javax.swing JFileChooser setDialogTitle

List of usage examples for javax.swing JFileChooser setDialogTitle

Introduction

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

Prototype

@BeanProperty(preferred = true, description = "The title of the JFileChooser dialog window.")
public void setDialogTitle(String dialogTitle) 

Source Link

Document

Sets the string that goes in the JFileChooser window's title bar.

Usage

From source file:uk.ac.lkl.cram.ui.ModuleFrame.java

private void exportReport() {
    JFileChooser jfc = new JFileChooser();
    jfc.setAcceptAllFileFilterUsed(false);
    jfc.setDialogTitle("Export CRAM Module");
    FileFilter filter = new FileNameExtensionFilter("Word Document", "docx");
    jfc.setFileFilter(filter);/*from   w  w  w.  j a  v a2 s .  c  o  m*/
    jfc.setSelectedFile(new File(module.getModuleName() + ".docx"));
    //Open the dialog and wait for the user to provide a name for the file
    int returnVal = jfc.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = jfc.getSelectedFile();
        //Add the file extension
        if (!jfc.getSelectedFile().getAbsolutePath().endsWith(".docx")) {
            file = new File(jfc.getSelectedFile() + ".docx");
        }
        try {
            this.setCursor(WAIT);
            Report report = new Report(module);
            report.save(file);
        } catch (Docx4JException ex) {
            LOGGER.log(Level.SEVERE, "Failed to export report", ex);
            JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(), "Failed to export report",
                    JOptionPane.ERROR_MESSAGE);
        } finally {
            this.setCursor(Cursor.getDefaultCursor());
        }
    }
}

From source file:cn.labthink.ReadAccess060.java

private void jButton_exportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_exportActionPerformed
    JFileChooser jfc = new JFileChooser();
    ExtensionFileFilter filter;//www . j a  va 2  s.  c o  m

    if (jTable1.getSelectedRowCount() == 1) {
        // filter
        filter = new ExtensionFileFilter("xls", false, true);
        filter.setDescription("Save Export File");

        jfc.setDialogTitle("Create the Export Excel file");
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    } else if (jTable1.getSelectedRowCount() > 1) {
        // filter
        filter = new ExtensionFileFilter("", false, true);
        filter.setDescription("Save Export Files");
        jfc.setDialogTitle("Choose the Export Directory");
        jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    } else {
        //?
        jLabel_info.setText("<html><font color='red'>No Record Selected</font></html>");
        return;
    }

    //?
    FileSystemView fsv = FileSystemView.getFileSystemView();
    //?
    jfc.setCurrentDirectory(fsv.getHomeDirectory());

    jfc.setMultiSelectionEnabled(false);
    jfc.setDialogType(JFileChooser.SAVE_DIALOG);

    jfc.setFileFilter(filter);
    int result = jfc.showSaveDialog(this); // ""?

    if (result == JFileChooser.APPROVE_OPTION) {
        if (jTable1.getSelectedRowCount() == 1) {
            //
            String filesrc = jfc.getSelectedFile().getAbsolutePath();
            if (!filesrc.toLowerCase().endsWith(".xls")) {
                filesrc = jfc.getSelectedFile().getAbsolutePath() + ".xls";
            }
            outputfile = new File(filesrc);
            jLabel_info.setText("Exported File:" + outputfile.getAbsolutePath());
        } else if (jTable1.getSelectedRowCount() > 1) {
            //
            outputfile = jfc.getSelectedFile().isDirectory() ? jfc.getSelectedFile()
                    : jfc.getSelectedFile().getParentFile();
            if (outputfile == null) {
                outputfile = fsv.getHomeDirectory();
            }
            jLabel_info.setText("Exported to path:" + outputfile.getAbsolutePath());
        } else {
            //?
            return;
        }

    } else {
        return;
    }

    if (inputfile == null) {
        return;
    }

    int[] rows = jTable1.getSelectedRows();
    if (rows.length == 1) {
        //?
        book = null;
        ExportOneRecord(rows[0]);
    } else {
        File path = outputfile;

        for (int rowindex = 0; rowindex < rows.length; rowindex++) {
            int k = rows[rowindex];
            book = null;
            outputfile = new File(path.getAbsolutePath() + "/" + jTable1.getValueAt(k, 0) + ".xls");
            ExportOneRecord(k);
        }
    }
    //        int k = jTable1.getSelectedRow();
    //        ExportOneRecord(k);

}

From source file:it.staiger.jmeter.protocol.http.config.gui.DynamicFilePanel.java

/**
 * Fills the table with the file parameters from the import settings panel
 *//*from  w  w  w.  j  av  a2  s .c  o m*/
private void importFiles() {
    String relPath = folder.getText();
    String replace = relPath + File.separator;
    if (relPath.isEmpty()) {
        relPath = FileDialoger.getLastJFCDirectory();
        replace = "";
    }

    JFileChooser chooser = new JFileChooser(new File(relPath));
    chooser.setMultiSelectionEnabled(true);
    chooser.setDialogTitle("select files");// $NON-NLS-1$

    if (chooser.showOpenDialog(GuiPackage.getInstance().getMainFrame()) == JFileChooser.APPROVE_OPTION) {
        File[] files = chooser.getSelectedFiles();
        for (File file : files) {
            String path = file.getAbsolutePath().replace(replace, "");
            String name = file.getName();
            int last = name.lastIndexOf(".");
            if (last != -1)
                name = name.substring(0, last);

            HTTPFileArg hFile = new HTTPFileArg(path, name, attachmentsCT.getText());

            addFile(hFile);
        }
        FileDialoger.setLastJFCDirectory(files[0].getAbsolutePath());
    }

}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Suche einen Platz und den Namen frs Logfile Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //from w  ww . j a va2s  .  c o  m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void chooseLogFile() {
    JFileChooser fileChooser;
    int retVal;
    //
    // Einen Dateiauswahldialog Creieren
    //
    fileChooser = new JFileChooser();
    fileChooser.setLocale(Locale.getDefault());
    fileChooser.setDialogTitle(fileChooserLogTitle);
    fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
    fileChooser.setApproveButtonToolTipText(approveLogButtonTooltip);
    // das existierende Logfile voreinstellen
    fileChooser.setSelectedFile(SpxPcloggerProgramConfig.logFile);
    retVal = fileChooser.showDialog(this, approveLogButtonText);
    // Mal sehen, was der User gewollt hat
    if (retVal == JFileChooser.APPROVE_OPTION) {
        // Ja, ich wollte das so
        // nach dem nchsten Programmstart dieses File anlegen/nutzen
        logfileNameTextField.setText(fileChooser.getSelectedFile().getAbsolutePath());
        wasChangedParameter = true;
        lg.debug("select <" + fileChooser.getSelectedFile().getName() + "> as new logfile after restart.");
    }
}

From source file:controller.CCInstance.java

private String userLoadLibraryPKCS11() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(Bundle.getBundle().getString("openLibrary"));
    int userSelection = fileChooser.showSaveDialog(null);
    if (userSelection == JFileChooser.APPROVE_OPTION) {
        String dest = fileChooser.getSelectedFile().getAbsolutePath();
        File file = new File(dest);
        if (file.exists()) {
            return dest;
        }/*from   ww w. jav  a  2s . c  om*/
    }
    return null;
}

From source file:com.claim.ui.UiReportType5.java

private void jButtonFolder3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFolder3ActionPerformed
    try {/*from   ww w.  j  a v  a  2s .c  o m*/
        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle("Open Folder");
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.setCurrentDirectory(new File(""));
        int result = fc.showOpenDialog(this);
        if (result == JFileChooser.APPROVE_OPTION) {
            File a = fc.getSelectedFile();
            // Path File method in this class
            String temp = a.getPath();
            txtPathFileType5.setText(".");

            if (temp != null) {
                txtPathFileType5.setText(temp);
                //txtPathFileOpaeIndv.setEnabled(true);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.fionera.javamailer.gui.mainView.controllerMain.java

/**
 * Adds the Actionlisteners to the Mainview
 *
 * @param viewMain The Mainview/*from ww  w.ja  v a  2s  .  com*/
 */
private void addActionListener(viewMain viewMain) {
    /**
     * Changes the Amount in the AmountLabel when the slider is moved
     */
    viewMain.getSetMailSettingsPanel().getSliderAmountMails().addChangeListener(e -> {
        Main.amountMails = ((JSlider) e.getSource()).getValue();
        viewMain.getSetMailSettingsPanel().getLabelNumberAmountMails()
                .setText("" + ((JSlider) e.getSource()).getValue());
    });

    /**
     * Changes the Delay in the DelayLabel when the slider is moved
     */
    viewMain.getSetMailSettingsPanel().getSliderDelayMails().addChangeListener(e -> {
        Main.delayMails = ((JSlider) e.getSource()).getValue();
        viewMain.getSetMailSettingsPanel().getLabelNumberDelayMails()
                .setText("" + ((JSlider) e.getSource()).getValue());
    });

    /**
     * Closes the Program, when close is clicked
     */
    viewMain.getCloseItem().addActionListener(e -> System.exit(0));

    /**
     * Opens the Settings when the settingsbutton is clicked
     */
    viewMain.getSettingsItem().addActionListener(e -> new controllerSettings());

    /**
     * Save current Setup
     */
    viewMain.getSaveSettings().addActionListener(e -> {
        JFileChooser jChooser = new JFileChooser();
        JFrame parentFrame = new JFrame();

        FileNameExtensionFilter filter = new FileNameExtensionFilter("Setup file", "jms", "Blub");
        jChooser.setFileFilter(filter);

        jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jChooser.setDialogTitle("Select Setup");

        int userSelection = jChooser.showSaveDialog(parentFrame);

        if (userSelection == JFileChooser.APPROVE_OPTION) {
            File fileToSave = new File(jChooser.getSelectedFile() + ".jms");

            saveSetup(viewMain, fileToSave, new ObjectMapper());
        }
    });

    /**
     * Load Setup
     */
    viewMain.getLoadSettings().addActionListener(e -> {
        JFileChooser jChooser = new JFileChooser();

        FileNameExtensionFilter filter = new FileNameExtensionFilter("Setup file", "jms", "Blub");
        jChooser.setFileFilter(filter);

        jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jChooser.setDialogTitle("Select Setup");
        jChooser.showOpenDialog(null);

        File file = jChooser.getSelectedFile();

        if (file != null) {
            if (file.getName().endsWith("jms")) {
                try {
                    loadSetup(viewMain, file, new ObjectMapper());
                } catch (Exception error) {
                    error.printStackTrace();
                }
            }
        }
    });

    /**
     * Opens the Open File dialog and start the Parsing of it
     */
    viewMain.getSelectRecipientsPanel().getSelectExcelFileButton().addActionListener(e -> {
        DefaultTableModel model;
        JFileChooser jChooser = new JFileChooser();

        jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Excel 97 - 2003 (.xls)", "xls"));
        jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Excel (.xlsx)", "xlsx"));
        jChooser.setDialogTitle("Select only Excel workbooks");
        jChooser.showOpenDialog(null);
        File file = jChooser.getSelectedFile();
        if (file != null) {
            parseFilesForImport parseFilesForImport = new parseFilesForImport();

            if (file.getName().endsWith("xls")) {
                ArrayList returnedData = parseFilesForImport.parseXLSFile(file);

                model = new DefaultTableModel((String[][]) returnedData.get(0), (String[]) returnedData.get(1));

                int tableWidth = model.getColumnCount() * 150;
                int tableHeight = model.getRowCount() * 25;
                viewMain.getSelectRecipientsPanel().getTable()
                        .setPreferredSize(new Dimension(tableWidth, tableHeight));

            } else if (file.getName().endsWith("xlsx")) {
                ArrayList returnedData = parseFilesForImport.parseXLSXFile(file);

                model = new DefaultTableModel((String[][]) returnedData.get(0), (String[]) returnedData.get(1));

                int tableWidth = model.getColumnCount() * 150;
                int tableHeight = model.getRowCount() * 25;
                viewMain.getSelectRecipientsPanel().getTable()
                        .setPreferredSize(new Dimension(tableWidth, tableHeight));

            } else {
                JOptionPane.showMessageDialog(null, "Please select only Excel file.", "Error",
                        JOptionPane.ERROR_MESSAGE);

                model = new DefaultTableModel();
            }
        } else {
            model = new DefaultTableModel();

        }

        viewMain.getSelectRecipientsPanel().getTable().setModel(model);

        int tableWidth = model.getColumnCount() * 150;
        int tableHeight = model.getRowCount() * 25;
        viewMain.getSelectRecipientsPanel().getTable().setPreferredSize(new Dimension(tableWidth, tableHeight));
        viewMain.getCheckAllSettings().getLabelRecipientsAmount().setText("" + model.getRowCount());
        viewMain.getCheckAllSettings().getLabelTimeAmount()
                .setText(""
                        + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue()
                                * viewMain.getSelectRecipientsPanel().getTable().getRowCount()
                                / viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue()
                        + " Seconds");
    });

    /**
     * Starts the sending of th Mails, when the send button is clicked
     */
    viewMain.getCheckAllSettings().getSendMails().addActionListener(e -> {

        String subject = viewMain.getSetMailSettingsPanel().getFieldSubject().getText();
        Sender sender = (Sender) viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem();
        JTable table = viewMain.getSelectRecipientsPanel().getTable();

        if (table != null && sender != null && !subject.equals("")) {
            new sendMails(viewMain);
        }
    });

    /**
     * Clears the Table on buttonclick
     */
    viewMain.getSelectRecipientsPanel().getClearTableButton().addActionListener(e -> {
        viewMain.getSelectRecipientsPanel().getTable().setModel(new DefaultTableModel());
        viewMain.getSelectRecipientsPanel().getTable().setBackground(null);

    });

    /**
     * Removes a single Row on menu click in the editMailPanel
     */
    viewMain.getSelectRecipientsPanel().getDeleteRow().addActionListener(e -> {
        ((DefaultTableModel) viewMain.getSelectRecipientsPanel().getTable().getModel())
                .removeRow(viewMain.getSelectRecipientsPanel().getTable().getSelectedRowCount());
        viewMain.getSelectRecipientsPanel().getTable().setBackground(null);

    });

    /**
     * The Changes the displayed Value when the Time in the Timespinner is getting changed.
     */
    viewMain.getSetMailSettingsPanel().getTimeSpinner().addChangeListener(e -> {
        parseDate.parseDate(viewMain);
        viewMain.getSetMailSettingsPanel().getLabelSendingIn().setText(parseDate.getDays() + " Days, "
                + parseDate.getHours() + " hours and " + parseDate.getMinutes() + " minutes remaining");
        viewMain.getSetMailSettingsPanel().getLabelSendingAt().setText(parseDate.getDate().toString());
        viewMain.getSetMailSettingsPanel().setDate(parseDate.getDate());

    });
    viewMain.getSetMailSettingsPanel().getDatePicker().addActionListener(e -> {
        parseDate.parseDate(viewMain);
        viewMain.getSetMailSettingsPanel().getLabelSendingIn().setText(parseDate.getDays() + " Days, "
                + parseDate.getHours() + " hours and " + parseDate.getMinutes() + " minutes remaining");
        viewMain.getSetMailSettingsPanel().getLabelSendingAt().setText(parseDate.getDate().toString());
        viewMain.getSetMailSettingsPanel().setDate(parseDate.getDate());
    });

    /**
     * Actionevent for the Edit Sender Button
     */
    viewMain.getSetMailSettingsPanel().getButtonEditSender()
            .addActionListener(e -> new controllerEditSender(controllerMain));

    /**
     * Actionevent for the Import Button in the EditMail View
     */
    viewMain.getEditMailPanel().getImportWord().addActionListener(e -> {
        JFileChooser jChooser = new JFileChooser();

        jChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        jChooser.addChoosableFileFilter(new FileNameExtensionFilter("Microsoft Word 97 - 2003 (.doc)", "doc"));
        jChooser.addChoosableFileFilter(new FileNameExtensionFilter("HTML File (.html)", "html"));
        jChooser.setDialogTitle("Select only Word Documents");
        jChooser.showOpenDialog(null);
        File file = jChooser.getSelectedFile();
        if (file != null) {
            parseFilesForImport parseFilesForImport = new parseFilesForImport();

            if (file.getName().endsWith("doc")) {
                String returnedData = parseFilesForImport.parseDOCFile(file);
                viewMain.getEditMailPanel().setEditorText(returnedData);

            } else if (file.getName().endsWith("html")) {
                String content = "";
                try {
                    content = Jsoup.parse(file, "UTF-8").toString();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }

                viewMain.getEditMailPanel().setEditorText(content);

            } else {
                JOptionPane.showMessageDialog(null, "Please select a Document file.", "Error",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    /**
     * The Tab Changelistener
     * The first if Statement sets the Labels on the Checkallsettings Panel to the right Values
     */
    viewMain.getTabbedPane().addChangeListener(e -> {
        if (viewMain.getTabbedPane().getSelectedComponent() == viewMain.getCheckAllSettings()) {

            viewMain.getCheckAllSettings().getLabelMailBelow()
                    .setText(viewMain.getEditMailPanel().getEditorText()); //Displays the Mail

            viewMain.getCheckAllSettings().getLabelRecipientsAmount()
                    .setText("" + viewMain.getSelectRecipientsPanel().getTable().getModel().getRowCount()); //Displays the Amount of Recipients

            if (viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem() != null) {
                viewMain.getCheckAllSettings().getLabelFromInserted().setText(
                        viewMain.getSetMailSettingsPanel().getSelectSender().getSelectedItem().toString());
            } else {
                viewMain.getCheckAllSettings().getLabelFromInserted().setText("Select a Sender first");
            }

            viewMain.getCheckAllSettings().getLabelSubjectInserted()
                    .setText(viewMain.getSetMailSettingsPanel().getFieldSubject().getText()); //Displays the Subject

            if (viewMain.getSetMailSettingsPanel().getCheckBoxDelayMails().isSelected()) {
                viewMain.getCheckAllSettings().getLabelDelay().setVisible(true);
                viewMain.getCheckAllSettings().getLabelAmount().setVisible(true);
                viewMain.getCheckAllSettings().getLabelTime().setVisible(true);
                viewMain.getCheckAllSettings().getLabelDelayNumber().setVisible(true);
                viewMain.getCheckAllSettings().getLabelAmountNumber().setVisible(true);
                viewMain.getCheckAllSettings().getLabelTimeAmount().setVisible(true);

                viewMain.getCheckAllSettings().getLabelDelayNumber()
                        .setText("" + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue()); //The Delay Number
                viewMain.getCheckAllSettings().getLabelAmountNumber()
                        .setText("" + viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue()); //The Amount of Mail in one package
                viewMain.getCheckAllSettings().getLabelTimeAmount()
                        .setText(""
                                + viewMain.getSetMailSettingsPanel().getSliderDelayMails().getValue()
                                        * viewMain.getSelectRecipientsPanel().getTable().getRowCount()
                                        / viewMain.getSetMailSettingsPanel().getSliderAmountMails().getValue()
                                + " Seconds"); //The Time the Sending needs

            } else {
                viewMain.getCheckAllSettings().getLabelDelay().setVisible(false);
                viewMain.getCheckAllSettings().getLabelAmount().setVisible(false);
                viewMain.getCheckAllSettings().getLabelTime().setVisible(false);
                viewMain.getCheckAllSettings().getLabelDelayNumber().setVisible(false);
                viewMain.getCheckAllSettings().getLabelAmountNumber().setVisible(false);
                viewMain.getCheckAllSettings().getLabelTimeAmount().setVisible(false);
            }

            if (viewMain.getSetMailSettingsPanel().getCheckBoxSendLater().isSelected()) {
                viewMain.getCheckAllSettings().getLabelSendingAt().setVisible(true);
                viewMain.getCheckAllSettings().getLabelSendingWhen().setVisible(true);
                viewMain.getCheckAllSettings().getLabelSendingAt()
                        .setText(viewMain.getSetMailSettingsPanel().getDate().toString());

            } else {
                viewMain.getCheckAllSettings().getLabelSendingAt().setVisible(false);
                viewMain.getCheckAllSettings().getLabelSendingWhen().setVisible(false);
            }

        }
    });

}

From source file:bio.gcat.gui.BDATool.java

public boolean openFile() {
    JFileChooser chooser = new FileNameExtensionFileChooser(BDA_EXTENSION_FILTER);
    chooser.setDialogTitle("Open");
    if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
        return false;

    return openFile(chooser.getSelectedFile());
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.AngleDirectController.java

/**
 *
 * @throws IOException/*from  ww w .jav a2s.co  m*/
 */
private void createPdf(JFreeChart chart) throws IOException {
    // choose directory to save pdf file
    JFileChooser chooseDirectory = new JFileChooser();
    chooseDirectory.setDialogTitle("Choose a directory to save the report");
    chooseDirectory.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    chooseDirectory.setSelectedFile(new File("chart rose plot" + ".pdf"));
    // in response to the button click, show open dialog
    int returnVal = chooseDirectory.showSaveDialog(angleDirectPanel);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File directory = chooseDirectory.getCurrentDirectory();
        PdfSwingWorker pdfSwingWorker = new PdfSwingWorker(directory,
                chooseDirectory.getSelectedFile().getName(), chart);
        pdfSwingWorker.execute();
    } else {
        singleCellPreProcessingController.showMessage("Open command cancelled by user", "",
                JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:my.swingconnect.SwingConnectUI.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

    //To BROWSE A FILE FROM THE DIRECTORY
    JFileChooser chooser = new JFileChooser();
    //To enable showing hidden file
    chooser.setFileHidingEnabled(false);
    //To Enable selecting directory or files
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    //To enable multiple file selections
    chooser.setMultiSelectionEnabled(true);
    //Choice of user to save or open a file
    chooser.setDialogType(JFileChooser.OPEN_DIALOG);
    chooser.setDialogTitle("Choose a file...");

    //To user to select a file
    if (chooser.showOpenDialog(SwingConnectUI.this) == JFileChooser.APPROVE_OPTION) {
        targetFile = chooser.getSelectedFile();
        String directory = targetFile.getPath();
        jTextField4.setText(targetFile.toString());

        //                       files = new File("/Users/pradil90/Desktop/207dropbox").listFiles();

        files = new File(directory).listFiles();
        for (File file : files) {
            if (file.isFile()) {
                results.add(file.getAbsolutePath());

                //                           results.add(file.getName());

                System.out.println(file);

                count++;/*w  w  w  .  ja v  a 2 s .  com*/

                System.out.println(count);

            }

        }

        results.remove(0);
        jButton3.setEnabled(true);

    }
}