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:org.pgptool.gui.ui.tools.browsefs.ExistingFileChooserDialog.java

private JFileChooser buildFileChooserDialog() {
    JFileChooser ofd = new JFileChooser();
    ofd.setFileSelectionMode(JFileChooser.FILES_ONLY);
    ofd.setAcceptAllFileFilterUsed(true);
    ofd.setMultiSelectionEnabled(false);
    ofd.setDialogTitle(Messages.get("action.chooseExistingFile"));
    ofd.setApproveButtonText(Messages.get("action.choose"));
    suggestInitialDirectory(ofd);//from   w  ww .j a va  2 s . c o m
    doFileChooserPostConstruct(ofd);
    return ofd;
}

From source file:org.pgptool.gui.ui.tools.browsefs.SaveFileChooserDialog.java

private JFileChooser prepareFileChooser() {
    JFileChooser ofd = new JFileChooser();
    ofd.setFileSelectionMode(JFileChooser.FILES_ONLY);
    ofd.setMultiSelectionEnabled(false);
    ofd.setDialogTitle(Messages.get(dialogTitleCode));
    ofd.setApproveButtonText(Messages.get(approvalButtonTextCode));
    onFileChooserPostConstrct(ofd);//from  w  ww  .  j  a  v  a  2  s . c  o m
    suggestTarget(ofd);
    return ofd;
}

From source file:org.pgptool.gui.ui.tools.browsefs.MultipleFilesChooserDialog.java

private JFileChooser buildFileChooserDialog() {
    JFileChooser ofd = new JFileChooser();
    ofd.setFileSelectionMode(JFileChooser.FILES_ONLY);
    ofd.setAcceptAllFileFilterUsed(true);
    ofd.setMultiSelectionEnabled(true);//from   ww  w. j a  v a2s .co  m
    ofd.setDialogTitle(Messages.get("action.chooseExistingFile"));
    ofd.setApproveButtonText(Messages.get("action.choose"));
    suggestInitialDirectory(ofd);
    doFileChooserPostConstruct(ofd);
    return ofd;
}

From source file:IHM.FenetreAjoutAffiche.java

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

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

    chooser.setDialogTitle("ouvrir une image");

    int reponse = chooser.showOpenDialog(this);

    boolean etat;

    if (reponse == JFileChooser.APPROVE_OPTION) {

        InputStream input = null;

        f = chooser.getSelectedFile();//from w ww. j  ava  2 s  . c  om

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

        txtNomPhoto.setText(nomAffiche);

    }

}

From source file:cc.creativecomputing.io.CCIOUtil.java

/**
 * Opens a platform-specific file chooser dialog to select a file for input. This function returns the full path to
 * the selected file as a <b>String</b>, or <b>null</b> if no selection. Files are filtered according to the given
 * file extensions.//from  ww  w . ja v  a  2s .co  m
 * 
 * @webref input:files
 * @param theExtensions file extensions for filtering
 * @return full path to the selected file, or null if canceled.
 * 
 * @see #selectOutput(String)
 * @see #selectFolder(String)
 */
static public String selectFilteredInput(String... theExtensions) {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileFilter(new CCFileExtensionFilter(theExtensions));
    fileChooser.setDialogTitle("Select a file...");

    int returned = fileChooser.showOpenDialog(null);
    if (returned == JFileChooser.CANCEL_OPTION) {
        selectedFile = null;
    } else {
        selectedFile = fileChooser.getSelectedFile();
    }
    return (selectedFile == null) ? null : selectedFile.getAbsolutePath();
}

From source file:edu.clemson.lph.civet.addons.VspsCviFile.java

public void importVspsFile(Window parent) {
    String sVspsDir = CivetConfig.getVspsDirPath();
    File fDir = new File(sVspsDir);
    JFileChooser open = new JFileChooser(fDir);
    Action details = open.getActionMap().get("viewTypeDetails");
    details.actionPerformed(null);//from   w  w  w  .  j a va2s.  co m
    open.setDialogTitle("Civet: Open PDF File");
    open.setFileSelectionMode(JFileChooser.FILES_ONLY);
    open.setFileFilter(new FileNameExtensionFilter("CSV Files", "csv"));
    open.setMultiSelectionEnabled(false);
    int resultOfFileSelect = open.showOpenDialog(parent);
    if (resultOfFileSelect == JFileChooser.APPROVE_OPTION) {
        File fIn = open.getSelectedFile();
        saveme(parent, fIn);
        //          vsps.printme();
    }

}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.generic.LoadGenericDRDataController.java

/**
 * Private methods//from   www.  java2s. c o m
 */
//init view
private void initDataLoadingPanel() {
    dataLoadingPanel = new DRDataLoadingPanel();
    /**
     * Action Listeners.
     */
    //Popup file selector and import and parse the file
    dataLoadingPanel.getChooseFileButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // Open a JFile Chooser
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle(
                    "Choose a tabular file (XLS, XLSX, CSV, TSV) for the import of the experiment");
            // to select only appropriate files
            fileChooser.setFileFilter(new FileFilter() {
                @Override
                public boolean accept(File f) {
                    if (f.isDirectory()) {
                        return true;
                    }
                    int index = f.getName().lastIndexOf(".");
                    String extension = f.getName().substring(index + 1);
                    return extension.equals("xls") || extension.equals("xlsx") || extension.equals("csv")
                            || extension.equals("tsv");
                }

                @Override
                public String getDescription() {
                    return (".xls, .xlsx, .csv and .tsv files");
                }
            });
            fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            fileChooser.setAcceptAllFileFilterUsed(false);
            // in response to the button click, show open dialog
            int returnVal = fileChooser.showOpenDialog(dataLoadingPanel);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File chosenFile = fileChooser.getSelectedFile();
                //                    // create and execute a new swing worker with the selected file for the import
                //                    ImportExperimentSwingWorker importExperimentSwingWorker = new ImportExperimentSwingWorker(chosenFile);
                //                    importExperimentSwingWorker.execute();
                parseDRFile(chosenFile);
                if (doseResponseController.getImportedDRDataHolder().getDoseResponseData() != null) {
                    dataLoadingPanel.getFileLabel().setText(chosenFile.getAbsolutePath());
                    doseResponseController.getGenericDRParentPanel().getNextButton().setEnabled(true);
                }
            } else {
                JOptionPane.showMessageDialog(dataLoadingPanel, "Command cancelled by user", "",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });

    dataLoadingPanel.getLogTransformCheckBox().addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                doseResponseController.setLogTransform(true);
            } else {
                doseResponseController.setLogTransform(false);
            }
        }
    });
}

From source file:net.sf.keystore_explorer.gui.actions.ExamineFileAction.java

private File chooseFile() {
    JFileChooser chooser = FileChooserFactory.getCertFileChooser();
    chooser.setCurrentDirectory(CurrentDirectory.get());
    chooser.setDialogTitle(res.getString("ExamineFileAction.ExamineFile.Title"));
    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(frame, res.getString("ExamineFileAction.ExamineFile.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File openFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(openFile);
        return openFile;
    }//from   www  . j  av a2 s  . co  m
    return null;
}

From source file:net.sf.keystore_explorer.gui.actions.SignCsrAction.java

private File chooseCsrFile() {
    JFileChooser chooser = FileChooserFactory.getCsrFileChooser();
    chooser.setCurrentDirectory(CurrentDirectory.get());
    chooser.setDialogTitle(res.getString("SignCsrAction.ChooseCsr.Title"));
    chooser.setMultiSelectionEnabled(false);

    int rtnValue = chooser.showDialog(frame, res.getString("SignCsrAction.ChooseCsr.button"));
    if (rtnValue == JFileChooser.APPROVE_OPTION) {
        File importFile = chooser.getSelectedFile();
        CurrentDirectory.updateForFile(importFile);
        return importFile;
    }//w  ww.  ja v  a  2 s. c  o  m
    return null;
}

From source file:test.integ.be.fedict.performance.util.PerformanceResultDialog.java

public PerformanceResultDialog(PerformanceResultsData data) {

    super((Frame) null, "Performance test results");
    setSize(1000, 800);//from ww w .  ja va 2 s . c  o  m

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    JMenuItem savePerformanceMenuItem = new JMenuItem("Save Performance");
    fileMenu.add(savePerformanceMenuItem);
    savePerformanceMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Save as PNG...");
            int result = fileChooser.showSaveDialog(PerformanceResultDialog.this);
            if (JFileChooser.APPROVE_OPTION == result) {
                File file = fileChooser.getSelectedFile();
                try {
                    ChartUtilities.saveChartAsPNG(file, performanceChart, 1024, 768);
                } catch (IOException e) {
                    JOptionPane.showMessageDialog(null, "error saving to file: " + e.getMessage());
                }
            }
        }

    });
    JMenuItem saveMemoryMenuItem = new JMenuItem("Save Memory");
    fileMenu.add(saveMemoryMenuItem);
    saveMemoryMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Save as PNG...");
            int result = fileChooser.showSaveDialog(PerformanceResultDialog.this);
            if (JFileChooser.APPROVE_OPTION == result) {
                File file = fileChooser.getSelectedFile();
                try {
                    ChartUtilities.saveChartAsPNG(file, memoryChart, 1024, 768);
                } catch (IOException e) {
                    JOptionPane.showMessageDialog(null, "error saving to file: " + e.getMessage());
                }
            }
        }

    });

    // memory chart
    memoryChart = getMemoryChart(data.getIntervalSize(), data.getMemory());

    // performance chart
    performanceChart = getPerformanceChart(data.getIntervalSize(), data.getPerformance(),
            data.getExpectedRevokedCount());

    Container container = getContentPane();
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    if (null != performanceChart) {
        splitPane.setTopComponent(new ChartPanel(performanceChart));
    }
    if (null != memoryChart) {
        splitPane.setBottomComponent(new ChartPanel(memoryChart));
    }
    splitPane.setDividerLocation(getHeight() / 2);
    splitPane.setDividerSize(1);
    container.add(splitPane);

    setVisible(true);
}