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:cool.pandora.modeller.ui.handlers.base.AddDataHandler.java

/**
 * addData.//from  ww  w .ja va2s . co m
 */
void addData() {
    final File selectFile = new File(File.separator + ".");
    final JFrame frame = new JFrame();
    final JFileChooser fc = new JFileChooser(selectFile);
    fc.setDialogType(JFileChooser.OPEN_DIALOG);
    fc.setMultiSelectionEnabled(true);
    fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fc.setDialogTitle("Add File or Directory");
    final int option = fc.showOpenDialog(frame);

    if (option == JFileChooser.APPROVE_OPTION) {
        final File[] files = fc.getSelectedFiles();
        final String message = ApplicationContextUtil.getMessage("bag.message.filesadded");
        if (files != null && files.length > 0) {
            addBagData(files);
            ApplicationContextUtil.addConsoleMessage(message + " " + getFileNames(files));
        } else {
            final File file = fc.getSelectedFile();
            addBagData(file);
            ApplicationContextUtil.addConsoleMessage(message + " " + file.getAbsolutePath());
        }
        bagView.bagPayloadTreePanel.refresh(bagView.bagPayloadTree);
        bagView.updateAddData();
    }
}

From source file:TextFileHandler.java

public File openFile(String title) {
    File result = null;/*from   w w w  .j  ava  2  s .co  m*/
    JFileChooser chooser = new JFileChooser(new File("."));
    if (title != null)
        chooser.setDialogTitle(title);
    int retVal = chooser.showOpenDialog(null);
    if (retVal == JFileChooser.APPROVE_OPTION) {
        result = chooser.getSelectedFile();
    }
    return result;
}

From source file:TextFileHandler.java

public File[] openFiles(String title) {
    File[] result = null;//  w  w  w.  j  a  va 2s  .  c om
    JFileChooser chooser = new JFileChooser(new File("."));
    if (title != null)
        chooser.setDialogTitle(title);
    chooser.setMultiSelectionEnabled(true);
    int retVal = chooser.showOpenDialog(null);
    if (retVal == JFileChooser.APPROVE_OPTION) {
        result = chooser.getSelectedFiles();
    }
    return result;
}

From source file:com.sf.energy.transfer.form.DataConfiguration.java

/**
 * ??//w w  w  .j a  v a  2s .  c  om
 * @param evt ?
 */
private void scanActionPerformed(java.awt.event.ActionEvent evt) {
    JFileChooser fc = new JFileChooser();
    File directory = new File(dir);
    // ??
    fc.setCurrentDirectory(directory);
    fc.setDialogTitle("");
    // 
    FileNameExtensionFilter filter1 = new FileNameExtensionFilter(".xls", "xls");
    fc.addChoosableFileFilter(filter1);
    FileNameExtensionFilter filter2 = new FileNameExtensionFilter(".dmp", "dmp");
    fc.addChoosableFileFilter(filter1);
    // 
    fc.setFileFilter(fc.getAcceptAllFileFilter());
    int intRetVal = fc.showOpenDialog(new JFrame());
    // ?
    if (intRetVal == JFileChooser.APPROVE_OPTION) {
        // ?
        dir = fc.getSelectedFile().getPath();
        // 
        filePath.setText(dir);
    }

}

From source file:networkanalyzer.NetworkAnalyzer.java

private void browseMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_browseMouseClicked
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File("."));
    chooser.setDialogTitle("Browse the folder to process");
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setAcceptAllFileFilterUsed(true);

    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        String fileName = chooser.getSelectedFile().toString();
        saveLoc.setText(fileName);//from   w  w w . j  a va  2s. c om
    }

}

From source file:com.igormaznitsa.jhexed.swing.editor.ui.dialogs.hexeditors.DialogEditSVGImageValue.java

private void buttonLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLoadActionPerformed
    final JFileChooser openDialog = new JFileChooser(lastOpenedFile);
    openDialog.setDialogTitle("Select SVG file");
    openDialog.setAcceptAllFileFilterUsed(true);
    openDialog.setFileFilter(Utils.SVG_FILE_FILTER);

    if (openDialog.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        lastOpenedFile = openDialog.getSelectedFile();
        try {/*  w w  w .  ja v a 2 s  . co m*/
            final SVGImage img = new SVGImage(lastOpenedFile);

            this.value.setImage(img);

            this.panelPreview.removeAll();
            this.panelPreview.add(
                    new JLabel(new ImageIcon(
                            img.rasterize(PREVIEW_SIZE, PREVIEW_SIZE, BufferedImage.TYPE_INT_ARGB))),
                    BorderLayout.CENTER);
            this.panelPreview.revalidate();
            this.panelPreview.repaint();

            this.buttonOk.setEnabled(true);
            this.buttonSaveAs.setEnabled(true);
        } catch (IOException ex) {
            Log.error("Can't rasterize image [" + lastOpenedFile + ']', ex);
            JOptionPane.showMessageDialog(this, "Can't load the file, may be it is not a SVG file",
                    "Can't load the file", JOptionPane.ERROR_MESSAGE);
        }
    }
}

From source file:be.ugent.maf.cellmissy.gui.controller.TracksWriterController.java

/**
 * Choose Directory/*from  w w w  . ja  va  2s  . c  o m*/
 */
private void chooseDirectory() {
    // Open a JFile Chooser
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Select directory to save the files");
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fileChooser.setAcceptAllFileFilterUsed(false);
    // in response to the button click, show open dialog
    int returnVal = fileChooser.showOpenDialog(tracksWriterDialog);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        directory = fileChooser.getSelectedFile();
    }
    tracksWriterDialog.getDirectoryTextField().setText(directory.getAbsolutePath());
}

From source file:modelibra.swing.app.util.FileSelector.java

/**
 * Selects a file (path)./*from   w  ww  . ja  va 2 s .co  m*/
 * 
 * @param lang
 *            language
 * @return chosen file path
 */
public String selectFile(NatLang lang) {
    JFileChooser fileChooser = new JFileChooser(lastFilePath);
    fileChooser.setLocale(lang.getLocale());
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fileChooser.setToolTipText(lang.getText("selectFile"));
    fileChooser.setDialogTitle(lang.getText("selectFile"));
    fileChooser.showDialog(null, lang.getText("selectFile"));
    File f = fileChooser.getSelectedFile();
    if (f != null) {
        lastFilePath = f.getPath();
        return lastFilePath;
    } else {
        return null;
    }
}

From source file:IHM.FenetreAjoutPhoto.java

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

    JFileChooser chooser = new JFileChooser(new File("."));

    chooser.setDialogTitle("ouvrir une image");

    int reponse = chooser.showOpenDialog(this);

    if (reponse == JFileChooser.APPROVE_OPTION) {

        InputStream input = null;

        f = chooser.getSelectedFile();//w  w w.j a va 2  s  .  co m

        nomPhoto = f.getName();
        nomF = f.getAbsolutePath();

        txtNomPhoto.setText(nomPhoto);

    }

}

From source file:com.compomics.cell_coord.gui.controller.load.LoadTracksController.java

/**
 * Choose the directory and load its data into a given JTree.
 *
 * @param dataTree/*from   www  .ja  v a  2s .c  om*/
 */
private void chooseDirectoryAndLoadData() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Please select a root folder containing your files");
    // allow for directories only
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // removing "All Files" option from FileType
    fileChooser.setAcceptAllFileFilterUsed(false);
    int returnVal = fileChooser.showOpenDialog(cellCoordController.getCellCoordFrame());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        // the directory for the data
        directory = fileChooser.getSelectedFile();
        try {
            loadDataIntoTree();
        } catch (LoadDirectoryException ex) {
            LOG.error(ex.getMessage());
            cellCoordController.showMessage(ex.getMessage(), "wrong directory structure error",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else {
        cellCoordController.showMessage("Open command cancelled by user", "", JOptionPane.INFORMATION_MESSAGE);
    }
}