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:coreferenceresolver.gui.MainGUI.java

private void chooseTestingFileBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTestingFileBtnActionPerformed
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose an testing file");
    inputFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        testingFilePathTF.setText(inputFileChooser.getSelectedFile().getAbsolutePath());
    } else {/*from  w  ww .  jav a2  s  .c o  m*/
        noteTF.setText("No testing file selected");
    }
}

From source file:coreferenceresolver.gui.MainGUI.java

private void chooseTrainingFileBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseTrainingFileBtnActionPerformed
    // TODO add your handling code here:
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose a training file");
    inputFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        trainingFilePathTF.setText(inputFileChooser.getSelectedFile().getAbsolutePath());
    } else {/*from ww  w.ja va2  s . co m*/
        noteTF.setText("No training file selected");
    }
}

From source file:com.emental.mindraider.ui.dialogs.AttachmentJDialog.java

/**
 * Concetructor.//from   w  w  w. j  a  v a 2s.c o m
 * 
 * @param noteResource
 *            The concept resource.
 * @param dragAndDropReference
 *            The drag'n'drop reference.
 */
public AttachmentJDialog(ConceptResource conceptResource, DragAndDropReference dragAndDropReference) {

    super(Messages.getString("AttachmentJDialog.title"));
    this.conceptResource = conceptResource;
    getContentPane().setLayout(new BorderLayout());
    JPanel p, pp;

    p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel intro = new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.introduction")
            + "&nbsp;&nbsp;<br><br></html>");
    p.add(intro, BorderLayout.NORTH);
    p.add(new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.description") + "</html>"),
            BorderLayout.CENTER);
    description = new JTextField(38);
    pp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pp.add(description);
    p.add(pp, BorderLayout.SOUTH);
    getContentPane().add(p, BorderLayout.NORTH);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.setBorder(new TitledBorder(Messages.getString("AttachmentJDialog.resource")));

    ButtonGroup attachType = new ButtonGroup();

    JPanel webPanel = new JPanel();
    webPanel.setLayout(new BorderLayout());
    webType = new JRadioButton(Messages.getString("AttachmentJDialog.web"));
    webType.setActionCommand(WEB);
    webType.addActionListener(this);
    webType.setSelected(true);
    attachType.add(webType);
    webPanel.add(webType, BorderLayout.NORTH);
    urlTextField = new JTextField("http://", 35);
    urlTextField.selectAll();
    urlTextField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                attach();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    p.add(urlTextField);
    webPanel.add(p, BorderLayout.SOUTH);
    mainPanel.add(webPanel, BorderLayout.NORTH);

    JPanel localPanel = new JPanel();
    localPanel.setLayout(new BorderLayout());
    JRadioButton localType = new JRadioButton(Messages.getString("AttachmentJDialog.local"));
    localType.setActionCommand(LOCAL);
    localType.addActionListener(this);
    localPanel.add(localType, BorderLayout.NORTH);
    pathTextField = new JTextField(35);
    pathTextField.setEnabled(false);
    browseButton = new JButton(Messages.getString("AttachmentJDialog.browse"));
    browseButton.setToolTipText(Messages.getString("AttachmentJDialog.browseTip"));
    browseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("AttachmentJDialog.attach"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("AttachmentJDialog.chooseAttachment"));
            fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = fc.showOpenDialog(AttachmentJDialog.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                pathTextField.setText(file.toString());
            }
        }
    });
    browseButton.setEnabled(false);
    pp = new JPanel();
    pp.setLayout(new BorderLayout());
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    pp.add(p, BorderLayout.NORTH);
    p.add(pathTextField);
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(browseButton);
    pp.add(p, BorderLayout.SOUTH);
    localPanel.add(pp, BorderLayout.SOUTH);
    attachType.add(localType);
    mainPanel.add(localPanel, BorderLayout.SOUTH);

    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // buttons
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton(Messages.getString("AttachmentJDialog.attach"));

    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            attach();
        }
    });
    JButton cancelButton = new JButton(Messages.getString("AttachmentJDialog.cancel"));
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AttachmentJDialog.this.dispose();
        }
    });
    getContentPane().add(p, BorderLayout.SOUTH);

    /*
     * drag and drop initialization
     */
    if (dragAndDropReference != null) {
        if (dragAndDropReference.getType() == DragAndDropReference.BROWSER_LINK) {
            urlTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(false);
            webType.setSelected(true);
            enableWebTypeButtons();
        } else {
            pathTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(true);
            webType.setSelected(false);
            enableLocalTypeButtons();
        }
        description.setText(dragAndDropReference.getTitle());
    }

    pack();
    Gfx.centerAndShowWindow(this);
}

From source file:aurelienribon.gdxsetupui.ui.panels.LibrarySelectionPanel.java

private void browse(String libraryName) {
    File file = libsSelectedFiles.get(libraryName);
    String path = file != null ? file.getPath() : ".";
    JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(this);

    JFileChooser chooser = new JFileChooser(new File(path));
    chooser.setFileFilter(new FileNameExtensionFilter("Zip files (*.zip)", "zip"));
    chooser.setDialogTitle("Please select the zip archive for \"" + libraryName + "\"");

    if (chooser.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
        select(libraryName, chooser.getSelectedFile());
    }//from  w  w  w .  j av a 2s  . c  o m
}

From source file:coreferenceresolver.gui.MainGUI.java

private void testBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testBtnActionPerformed
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose where your testing file saved");
    inputFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        testingFilePathTF/* www .  ja v a  2  s . co m*/
                .setText(inputFileChooser.getSelectedFile().getAbsolutePath() + File.separator + "test.arff");
        noteTF.setText("Create testing file waiting ...");
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    TrainingMain.run(inputFilePathTF.getText(), markupFilePathTF.getText(),
                            testingFilePathTF.getText(), false);
                    noteTF.setText("Create testing file done!");
                    String folderPathOpen = testingFilePathTF.getText().substring(0,
                            testingFilePathTF.getText().lastIndexOf(File.separatorChar));
                    Desktop.getDesktop().open(new File(folderPathOpen));
                } catch (Exception ex) {
                    Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }).start();
    } else {
        noteTF.setText("No testing file location selected");
    }
}

From source file:de.uka.ilkd.key.dl.gui.initialdialog.gui.ToolInstaller.java

public void install(JComponent parent, Window dialog) {

    final File installDirectory;
    switch (OSInfosDefault.INSTANCE.getOs()) {
    case OSX:/*from ww  w .  j a  v  a2 s. c  o  m*/
        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        FileDialog d = new FileDialog(Frame.getFrames()[0], "Choose directory for installation of " + toolName,
                FileDialog.LOAD);
        d.setVisible(true);
        System.setProperty("apple.awt.fileDialogForDirectories", "false");
        if (d.getFile() != null) {
            installDirectory = new File(d.getDirectory(), d.getFile());
        } else {
            installDirectory = null;
        }
        break;
    default:
        final JFileChooser chooser = new JFileChooser();
        chooser.setMultiSelectionEnabled(false);
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setDialogTitle("Choose directory for installation of " + toolName);
        chooser.setDialogType(JFileChooser.SAVE_DIALOG);
        chooser.setApproveButtonText("Install " + toolName + " here");
        int result = chooser.showDialog(parent, "Install " + toolName + " here");
        if (result == JFileChooser.APPROVE_OPTION) {
            installDirectory = chooser.getSelectedFile();
        } else {
            installDirectory = null;
        }
    }

    if (installDirectory != null) {
        try {
            final File tmp = File.createTempFile("keymaeraDownload", "." + ft.toString().toLowerCase());
            final FileInfo info = new FileInfo(url, tmp.getName(), false);
            final DownloadManager dlm = new DownloadManager();
            ProgressBarWindow pbw = new ProgressBarWindow(parent, installDirectory, tmp, ft, ps, dialog);
            dlm.addListener(pbw);
            Runnable down = new Runnable() {

                @Override
                public void run() {
                    dlm.downloadAll(new FileInfo[] { info }, 2000, tmp.getParentFile().getAbsolutePath(), true);
                }
            };
            Thread thread = new Thread(down);
            thread.start();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

From source file:coreferenceresolver.gui.MainGUI.java

private void markupBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_markupBtnActionPerformed
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose where your markup file saved");
    inputFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        String[] inputFilePath = inputFilePathTF.getText().split("\\\\");
        String inputFileName = inputFilePath[inputFilePath.length - 1];
        markupFilePathTF.setText(inputFileChooser.getSelectedFile().getAbsolutePath() + File.separator
                + inputFileName + ".markup");
        noteTF.setText("Markup waiting ...");
        new Thread(new Runnable() {
            @Override/* w  w  w. j av a2  s  .c  o  m*/
            public void run() {
                try {
                    MarkupMain.markup(inputFilePathTF.getText(), markupFilePathTF.getText());
                    noteTF.setText("Markup done!");
                    String folderPathOpen = markupFilePathTF.getText().substring(0,
                            markupFilePathTF.getText().lastIndexOf(File.separatorChar));
                    Desktop.getDesktop().open(new File(folderPathOpen));
                } catch (IOException ex) {
                    Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }).start();
    } else {
        return;
    }
}

From source file:coreferenceresolver.gui.MainGUI.java

private void trainingBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trainingBtnActionPerformed
    // TODO add your handling code here:
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose where your training file saved");
    inputFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        trainingFilePathTF/*from   w  ww  .  j  av a  2  s.  com*/
                .setText(inputFileChooser.getSelectedFile().getAbsolutePath() + File.separator + "train.arff");
        noteTF.setText("Create training file waiting ...");
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    TrainingMain.run(inputFilePathTF.getText(), markupFilePathTF.getText(),
                            trainingFilePathTF.getText(), true);
                    noteTF.setText("Create training file done!");
                    String folderPathOpen = trainingFilePathTF.getText().substring(0,
                            trainingFilePathTF.getText().lastIndexOf(File.separatorChar));
                    Desktop.getDesktop().open(new File(folderPathOpen));
                } catch (Exception ex) {
                    Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }).start();
    } else {
        noteTF.setText("No training file location selected");
    }
}

From source file:coreferenceresolver.gui.MainGUI.java

private void applyClassifierBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyClassifierBtnActionPerformed
    JFileChooser inputFileChooser = new JFileChooser(defaulPath);
    inputFileChooser.setDialogTitle("Choose where your classified result file saved");
    inputFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    if (inputFileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        resultFilePathTF1.setText(inputFileChooser.getSelectedFile().getAbsolutePath() + File.separator
                + "classified_result.txt");
        noteTF.setText("Create classified result file waiting ...");

        new Thread(new Runnable() {
            @Override/*from  w ww.  ja va  2s  .  co m*/
            public void run() {
                try {
                    WekaMain.run(inputFilePathTF.getText(), markupFilePathTF.getText(),
                            trainingFilePathTF.getText(), testingFilePathTF.getText(),
                            resultFilePathTF1.getText());
                    noteTF.setText("Create result file done!");
                    String folderPathOpen = resultFilePathTF1.getText().substring(0,
                            resultFilePathTF1.getText().lastIndexOf(File.separatorChar));
                    Desktop.getDesktop().open(new File(folderPathOpen));
                    //Open the window for predicted chains                    
                    ClassifiedResultGUI.render(true);
                    //Open the window for actual chains                    
                    ClassifiedResultGUI.render(false);
                } catch (Exception ex) {
                    Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }).start();

    } else {
        noteTF.setText("No classified result file location selected");
    }
}

From source file:net.sf.profiler4j.console.Console.java

/**
 * Saves the current project.//from  ww  w  .  java  2s .c  om
 * 
 * @param saveAs force the user to select a file name even
 * @return <code>true</code> if the user has cancelled (only in the case of save as)
 */
public boolean saveProject(boolean saveAs) {
    if (project.getFile() == null || saveAs) {
        JFileChooser fc = new JFileChooser(lastDir);

        fc.setDialogTitle("Save Project As");

        fc.addChoosableFileFilter(projectFilter);
        if (fc.showSaveDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {
            File f = fc.getSelectedFile();
            if (!f.getName().endsWith(".p4j")) {
                f = new File(f.getAbsolutePath() + ".p4j");
            }
            project.setFile(f);
        } else {
            return true;
        }
    }

    Element rootEl = new Element("Profiler4jProject");
    Document doc = new Document(rootEl);

    rootEl.addContent(new Element("Host").setText(project.getHostname()));
    rootEl.addContent(new Element("Port").setText(String.valueOf(project.getPort())));

    Element rulesEl = new Element("Rules");
    rootEl.addContent(rulesEl);

    rulesEl.setAttribute("access", project.getAccess().name());
    rulesEl.setAttribute("beanProps", String.valueOf(project.isBeanprops()));

    for (Rule rule : project.getRules()) {
        rulesEl.addContent(
                new Element("Rule").setText(rule.getPattern()).setAttribute("action", rule.getAction().name()));
    }

    Element exportPatternEl = new Element(PROJECT_XML_ELEMENT__EXPORT_PATTERN);
    String enabled = String.valueOf(project.isExportAutomaticallyEnabled());
    exportPatternEl.setAttribute(PROJECT_XML_ATTRIBUTE__ENABLED, enabled);
    exportPatternEl.setAttribute(PROJECT_XML_ATTRIBUTE__PATTERN, project.getExportPattern());
    rootEl.addContent(exportPatternEl);

    try {
        FileWriter fw = new FileWriter(project.getFile());
        XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
        outputter.output(doc, fw);
        fw.close();
        project.clearChanged();
    } catch (IOException e) {
        error("I/O Error", e);
    }
    return false;
}