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:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java

protected File[] askUserForImageFiles() {
    ImageFilter imageFilter = new ImageFilter();
    JFileChooser fileChooser = new JFileChooser(
            WorkbenchTask.getDefaultDirPath(WorkbenchTask.IMAGES_FILE_PATH));
    fileChooser.setFileFilter(imageFilter);
    fileChooser.setDialogTitle(getResourceString("WB_CHOOSE_IMAGES"));
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fileChooser.setMultiSelectionEnabled(true);

    int userAction = fileChooser.showOpenDialog(this);
    AppPreferences localPrefs = AppPreferences.getLocalPrefs();

    // remember the directory the user was last in
    localPrefs.put(WorkbenchTask.IMAGES_FILE_PATH, fileChooser.getCurrentDirectory().getAbsolutePath());

    if (userAction == JFileChooser.APPROVE_OPTION) {
        return fileChooser.getSelectedFiles();
    }/*from   ww w  .j  av  a 2  s . c o  m*/

    // if for any reason we got to this point...
    return null;
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java

protected File askUserForImageFile() {
    ImageFilter imageFilter = new ImageFilter();
    JFileChooser fileChooser = new JFileChooser(
            WorkbenchTask.getDefaultDirPath(WorkbenchTask.IMAGES_FILE_PATH));
    fileChooser.setFileFilter(imageFilter);
    fileChooser.setDialogTitle(getResourceString("WB_CHOOSE_IMAGE"));
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    int userAction = fileChooser.showOpenDialog(this);
    AppPreferences localPrefs = AppPreferences.getLocalPrefs();

    // remember the directory the user was last in
    localPrefs.put(WorkbenchTask.IMAGES_FILE_PATH, fileChooser.getCurrentDirectory().getAbsolutePath());

    if (userAction == JFileChooser.APPROVE_OPTION) {
        String fullPath = fileChooser.getSelectedFile().getAbsolutePath();
        if (imageFilter.isImageFile(fullPath)) {
            return fileChooser.getSelectedFile();
        }/* ww w .j av a 2  s  .c o  m*/
    }

    // if for any reason (user cancelled) we got to this point...
    return null;
}

From source file:ca.canucksoftware.clockthemebuilder.ThemeBuilderView.java

private File loadFileChooser(javax.swing.filechooser.FileFilter ff, String saveName) {
    File result;//from  www  . j ava  2s.  co  m
    JFileChooser fc = new JFileChooser(); //Create a file chooser
    fc.setMultiSelectionEnabled(false);
    if (ff != null) {
        fc.setAcceptAllFileFilterUsed(false);
        fc.setFileFilter(ff);
    } else {
        fc.setAcceptAllFileFilterUsed(true);
    }
    if (saveName == null) {
        fc.setDialogTitle("");
        if (fc.showDialog(null, "Select") == JFileChooser.APPROVE_OPTION) {
            result = fc.getSelectedFile();
        } else {
            result = null;
        }
    } else {
        fc.setDialogTitle("Save As...");
        fc.setSelectedFile(new File(saveName));
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            result = fc.getSelectedFile();
        } else {
            result = null;
        }
    }
    return result;
}

From source file:lejos.pc.charting.LogChartFrame.java

private void selectFolderButton_actionPerformed(ActionEvent e) {
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    JFileChooser jfc = new JFileChooser(new File(FQPathTextArea.getText(), ""));
    jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    jfc.setApproveButtonText("Select");
    jfc.setDialogTitle("Select Directory");
    jfc.setDialogType(JFileChooser.OPEN_DIALOG);
    this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    int returnVal = jfc.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        FQPathTextArea.setText(getCanonicalName(jfc.getSelectedFile()));
        jfc.setCurrentDirectory(jfc.getSelectedFile());
        System.out.println("folder set to \"" + getCanonicalName(jfc.getSelectedFile()) + "\"");
    }//www . j a v a  2 s.c o  m
}

From source file:com.jug.MotherMachine.java

/**
 * Shows a JFileChooser set up to accept the selection of folders.
 * If 'cancel' is pressed this method terminates the MotherMachine app.
 *
 * @param guiFrame/*from www . j  a  va  2  s  .  co m*/
 *            parent frame
 * @param path
 *            path to the folder to open initially
 * @return an instance of {@link File} pointing at the selected folder.
 */
private File showFolderChooser(final JFrame guiFrame, final String path) {
    final JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File(path));
    chooser.setDialogTitle("Select folder containing image sequence...");
    chooser.setFileFilter(new FileFilter() {

        @Override
        public final boolean accept(final File file) {
            return file.isDirectory();
        }

        @Override
        public String getDescription() {
            return "We only take directories";
        }
    });
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showOpenDialog(guiFrame) == JFileChooser.APPROVE_OPTION) {
        return chooser.getSelectedFile();
    } else {
        System.exit(0);
        return null;
    }
}

From source file:base.BasePlayer.AddGenome.java

static void downloadGenome(String urls) {
    try {/*from   www .j  a v a  2  s  .  co m*/

        URL fastafile = AddGenome.genomeHash.get(urls)[0];
        String targetDir = "";
        //boolean writable = true;

        File test = new File(Main.genomeDir.getCanonicalPath() + "/test");

        //File f = new File(Main.genomeDir.getCanonicalPath());         

        if (test.mkdir()) {
            /*if(fastafile.getFile().contains("GRCh38")) {
                      
                  if((test.getFreeSpace()/1048576) < (60000000000L/1048576)) {
              Main.showError("Sorry, you need more than 60GB of disk space to install GRCh38.\nGRCh38 FASTA file size is ~50GB uncompressed.\nThis drive has " +test.getFreeSpace()/1048576/1000 +"GB.", "Note");
              test.delete();
              return;
                  }                                                    
               }
            else*/ if ((test.getFreeSpace() / 1048576) < (5000000000L / 1048576)) {
                Main.showError("Sorry, you need more than 5GB of disk space.\nThis drive has "
                        + test.getFreeSpace() / 1048576 / 1000 + "GB.", "Note");
                test.delete();
                return;
            }
            test.delete();

            targetDir = Main.genomeDir.getCanonicalPath() + "/" + urls + "/";
            File fasta = new File(targetDir + FilenameUtils.getName(fastafile.getFile()));
            URL gfffile = AddGenome.genomeHash.get(urls)[1];
            targetDir = Main.genomeDir.getCanonicalPath() + "/" + urls + "/annotation/"
                    + FilenameUtils.getName(gfffile.getFile()) + "/";
            File gff = new File(targetDir + FilenameUtils.getName(gfffile.getFile()));
            AddGenome.OutputRunner genomeadd = new AddGenome.OutputRunner(urls, fasta, gff, urls);
            genomeadd.createGenome = true;
            genomeadd.execute();
        } else {
            try {

                JFileChooser chooser = new JFileChooser();
                chooser.setAcceptAllFileFilterUsed(false);
                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                chooser.setDialogTitle("Select a local directory for genome files...");
                File outfile = null;

                while (true) {
                    int returnVal = chooser.showSaveDialog((Component) AddGenome.panel);

                    if (returnVal == JFileChooser.APPROVE_OPTION) {
                        outfile = chooser.getSelectedFile();
                        File genomedir = new File(outfile.getCanonicalPath() + "/genomes");
                        if (new File(outfile.getCanonicalPath() + "/genomes").mkdir()) {
                            if (fastafile.getFile().contains("GRCh38")) {
                                if ((outfile.getFreeSpace() / 1048576) < (200000000000L / 1048576)) {
                                    Main.showError(
                                            "Please, select local drive with more than 60GB of disk space.\nGRCh38 FASTA file is ~50GB uncompressed.\nThis drive has "
                                                    + outfile.getFreeSpace() / 1048576 / 1000 + "GB.",
                                            "Note");
                                    genomedir.delete();
                                    continue;
                                }
                            } else if ((outfile.getFreeSpace() / 1048576) < (5000000000L / 1048576)) {
                                Main.showError(
                                        "Please, select local drive with more than 5GB of disk space.\nThis drive has "
                                                + outfile.getFreeSpace() / 1048576 / 1000 + "GB.",
                                        "Note");
                                genomedir.delete();
                                continue;
                            }
                        } else {
                            Main.showError(
                                    "No writing permissions for this directory. \nPlease, select new directory for genomes.",
                                    "Error");
                            continue;
                        }

                        /*if (!new File(outfile.getCanonicalPath() +"/genomes").mkdir()) {
                           Main.showError("Could not create genome directory in " +outfile.getCanonicalPath(), "Error");
                           continue;
                        }*/

                        break;
                    }
                    if (returnVal == JFileChooser.CANCEL_OPTION) {
                        outfile = null;
                        downloading = false;
                        break;
                    }
                }
                if (outfile != null) {
                    Main.genomeDir = new File(outfile.getCanonicalPath() + "/genomes");
                    genomedirectory.setText(Main.genomeDir.getCanonicalPath());
                    Main.writeToConfig("genomeDir=" + Main.genomeDir.getCanonicalPath());
                    targetDir = Main.genomeDir.getCanonicalPath() + "/" + urls + "/";
                    File fasta = new File(targetDir + FilenameUtils.getName(fastafile.getFile()));
                    URL gfffile = AddGenome.genomeHash.get(urls)[1];
                    targetDir = Main.genomeDir.getCanonicalPath() + "/" + urls + "/annotation/"
                            + FilenameUtils.getName(gfffile.getFile()) + "/";
                    File gff = new File(targetDir + FilenameUtils.getName(gfffile.getFile()));
                    AddGenome.OutputRunner genomeadd = new AddGenome.OutputRunner(urls, fasta, gff, urls);
                    genomeadd.createGenome = true;
                    genomeadd.execute();
                }
                downloading = false;
                /* new File(outfile.getCanonicalPath() +"/genomes").mkdir();
                File fasta = new File(targetDir +FilenameUtils.getName(fastafile.getFile()));                     
                        
                URL gfffile= AddGenome.genomeHash.get(urls)[1];
                targetDir = AddGenome.userDir +"/genomes/" +urls +"/annotation/" +FilenameUtils.getName(gfffile.getFile()) +"/";
                File gff = new File(targetDir +FilenameUtils.getName(gfffile.getFile()));
                        
                AddGenome.OutputRunner genomeadd = new AddGenome.OutputRunner(urls, fasta, gff, urls);
                genomeadd.createGenome = true;
                genomeadd.execute();
                */
            } catch (Exception ex) {
                downloading = false;
                ex.printStackTrace();
            }

        }

    } catch (Exception e) {
        downloading = false;
        e.printStackTrace();
    }

}

From source file:edu.synth.SynthHelper.java

public String openDialogFileChooser(String path, boolean dirOnly, String name, String button,
        String filterType) {/*from w  w w .ja va2s  .c om*/
    JFileChooser fileOpen = new JFileChooser();
    if (!path.isEmpty())
        fileOpen.setCurrentDirectory(new File(path));
    else
        fileOpen.setCurrentDirectory(new File("."));
    if (dirOnly)
        fileOpen.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    else {
        fileOpen.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        switch (filterType) {
        case "abn":
            FileFilter filter = new FileNameExtensionFilter("*.abn - Abundances file", "abn");
            fileOpen.setFileFilter(filter);
            break;
        case "model":
            filter = new FileNameExtensionFilter("*.atl - Kurucz's format model file", "atl");
            fileOpen.setFileFilter(filter);
            break;
        case "lns":
            filter = new FileNameExtensionFilter("*.lns - Lines file", "lns");
            fileOpen.setFileFilter(filter);
            break;
        }
    }
    fileOpen.setDialogTitle(name);
    fileOpen.setApproveButtonText(button);
    int returnVal = fileOpen.showOpenDialog(fileOpen);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File selectedPath = fileOpen.getSelectedFile();
        if (selectedPath != null)
            return selectedPath.getAbsolutePath();
    }
    return "";
}

From source file:org.pentaho.support.standalone.SDSupportUtility.java

/**
 * initializing UI//from www . jav  a2  s.c  om
 * 
 * @throws Exception
 */
public SDSupportUtility() throws Exception {

    prop = loadProperty();

    setResizable(false);
    setTitle(SDConstant.PENT_SUP_WIZARD);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 665, 516);

    contentPane = new JPanel();
    contentPane.setBackground(UIManager.getColor("Button.background"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblLastAttached = new JLabel("Last Attached");
    lblLastAttached.setOpaque(false);
    lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT);
    lblLastAttached.setBounds(322, 335, 127, 23);
    contentPane.add(lblLastAttached);

    JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard");
    lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51));
    lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP);
    lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT);
    lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23));
    lblPentahoCustomerSupport.setBounds(130, 109, 506, 37);
    contentPane.add(lblPentahoCustomerSupport);

    JLabel lbllogo = new JLabel();
    lbllogo.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png")));
    lbllogo.setBounds(10, 11, 409, 93);
    contentPane.add(lbllogo);

    chckbxNewCheckBoxEnvironment = new JCheckBox("Environment");
    chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.ENVIRONMENT);
            } else {
                ArgList.remove(SDConstant.ENVIRONMENT);
            }
        }
    });
    chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23);
    contentPane.add(chckbxNewCheckBoxEnvironment);
    chckbxNewCheckBoxEnvironment.setOpaque(false);

    chckbxNewCheckBoxStructure = new JCheckBox("Structure Details");
    chckbxNewCheckBoxStructure.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.STRUCT);
            } else {
                ArgList.remove(SDConstant.STRUCT);
            }
        }
    });
    chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23);
    contentPane.add(chckbxNewCheckBoxStructure);
    chckbxNewCheckBoxStructure.setOpaque(false);

    chckbxLogs = new JCheckBox("Logs");
    chckbxLogs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LOGS);
            } else {
                ArgList.remove(SDConstant.LOGS);
            }
        }
    });
    chckbxLogs.setBounds(377, 164, 248, 23);
    contentPane.add(chckbxLogs);
    chckbxLogs.setOpaque(false);

    chckbxGetSecureFiles = new JCheckBox("Secure Files");
    chckbxGetSecureFiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.SECURITY);
            } else {
                ArgList.remove(SDConstant.SECURITY);
            }
        }
    });
    chckbxGetSecureFiles.setBounds(109, 190, 243, 23);
    contentPane.add(chckbxGetSecureFiles);
    chckbxGetSecureFiles.setOpaque(false);

    chckbxMd5 = new JCheckBox("MD5 Hash Value");
    chckbxMd5.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.MD5);
            } else {
                ArgList.remove(SDConstant.MD5);
            }
        }
    });
    chckbxMd5.setBounds(109, 216, 243, 23);
    contentPane.add(chckbxMd5);
    chckbxMd5.setOpaque(false);

    chckbxDbdetails = new JCheckBox("Datasource Details");
    chckbxDbdetails.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.DATASOURCE);
            } else {
                ArgList.remove(SDConstant.DATASOURCE);
            }
        }
    });
    chckbxDbdetails.setBounds(109, 294, 243, 23);
    contentPane.add(chckbxDbdetails);
    chckbxDbdetails.setOpaque(false);

    chckbxLicense = new JCheckBox("License File");
    chckbxLicense.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LICENSE);
            } else {
                ArgList.remove(SDConstant.LICENSE);
            }
        }
    });
    chckbxLicense.setBounds(109, 164, 243, 23);
    contentPane.add(chckbxLicense);
    chckbxLicense.setOpaque(false);

    chckbxProcesslist = new JCheckBox("Running Process");
    chckbxProcesslist.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.RUNNING_TASK);
            } else {
                ArgList.remove(SDConstant.RUNNING_TASK);
            }
        }
    });
    chckbxProcesslist.setBounds(109, 242, 243, 23);
    contentPane.add(chckbxProcesslist);
    chckbxProcesslist.setOpaque(false);

    chckbxTomcatxml = new JCheckBox("XML files from Tomcat");
    chckbxTomcatxml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                tomcatXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                tomcatXml = false;
            }
        }
    });
    chckbxTomcatxml.setBounds(377, 242, 248, 23);
    contentPane.add(chckbxTomcatxml);
    chckbxTomcatxml.setOpaque(false);

    chckbxServerXml = new JCheckBox("XML files from Server");
    chckbxServerXml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverXml = false;
            }
        }
    });
    chckbxServerXml.setBounds(377, 216, 248, 23);
    contentPane.add(chckbxServerXml);
    chckbxServerXml.setOpaque(false);

    chckbxGetBatfiles = new JCheckBox("Start up files from server");
    chckbxGetBatfiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverBatFile = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverBatFile = false;
            }
        }
    });
    chckbxGetBatfiles.setBounds(377, 268, 248, 23);
    contentPane.add(chckbxGetBatfiles);
    chckbxGetBatfiles.setOpaque(false);

    chckbxServerproperties = new JCheckBox("Properites files from server");
    chckbxServerproperties.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverProrperties = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverProrperties = false;
            }
        }
    });
    chckbxServerproperties.setBounds(377, 294, 248, 23);
    contentPane.add(chckbxServerproperties);
    chckbxServerproperties.setOpaque(false);

    btnNewButton = new JButton("Package");
    btnNewButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {

            try {

                if (installType.equalsIgnoreCase("Manual")) {

                    if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                        JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                                JOptionPane.ERROR_MESSAGE);
                    } else {

                        WEB_XML = new StringBuilder();
                        WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator)
                                .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO)
                                .append(File.separator).append(SDConstant.WEB_INF).append(File.separator)
                                .append(SDConstant.WEB_XML);

                        PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString());
                        prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH);
                        prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH);
                    }

                }

                if (prop.getProperty(SDConstant.BI_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                disableAll();
                setBIServerPath(prop);
                final String data = textFieldBrowser.getText();
                if (!data.equalsIgnoreCase(null)) {
                    ArgList.add(SDConstant.BROWSER);
                }

                String[] array = new String[ArgList.size()];

                int count = 0;
                for (int i = 0; i < ArgList.size(); i++) {

                    String retName = ArgList.get(i);
                    if (retName.equals("file")) {
                        if (count == 0) {
                            array[i] = retName;
                            count++;
                        }
                    } else {
                        array[i] = retName;
                    }

                }

                ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME);

                factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory");
                ConfigRetreiver[] config = factory.getConfigRetrevier(array);

                ExecutorService service = Executors.newFixedThreadPool(10);

                for (final ConfigRetreiver configobj : config) {
                    if (null != configobj) {
                        configobj.setBISeverPath(prop);
                        configobj.setServerName("biserver");

                        if (installType.equalsIgnoreCase("Installer")) {
                            configobj.setInstallType("Installer");
                        } else if (installType.equalsIgnoreCase("Archive")) {
                            configobj.setInstallType("Archive");
                        } else if (installType.equalsIgnoreCase("Manual")) {
                            configobj.setInstallType("Manual");
                        }

                        if (configobj instanceof FileRetriever) {
                            configobj.setBidiXml(serverXml);
                            configobj.setBidiBatFile(serverBatFile);
                            configobj.setBidiProrperties(serverProrperties);
                            configobj.setTomcatXml(tomcatXml);
                        }
                        if (configobj instanceof BrowserInfoRetriever) {
                            configobj.setBrowserInfo(data);
                        }

                        service.execute(new Runnable() {
                            public void run() {
                                if (null != configobj)
                                    configobj.readAndSaveConfiguration(prop);
                            }
                        });
                    }
                }
                btnNewButton.setVisible(false);
                progressBar.setVisible(true);
                ProgressThread thread = new ProgressThread();
                thread.setSupport(getSupport());
                thread.setProp(prop);
                new Thread(thread).start();

                service.shutdown();
            } catch (Exception e1) {
                e1.printStackTrace();
            }

        }

    });

    chckbxSelectAll = new JCheckBox("Select/ De-select");
    chckbxSelectAll.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectAll();
            } else {
                deSelectAll();
            }
        }
    });

    chckbxSelectAll.setBounds(46, 138, 201, 23);
    chckbxSelectAll.setOpaque(false);
    contentPane.add(chckbxSelectAll);
    btnNewButton.setForeground(SystemColor.infoText);
    btnNewButton.setBounds(10, 430, 639, 37);
    contentPane.add(btnNewButton);
    chckbxServerproperties.setOpaque(false);

    JLabel lblAttach = new JLabel("Attach Artifact");
    lblAttach.setHorizontalAlignment(SwingConstants.LEFT);
    lblAttach.setBounds(32, 335, 177, 23);
    contentPane.add(lblAttach);
    lblAttach.setOpaque(false);

    JButton btnNewButtonBrowse = new JButton("Browse");
    btnNewButtonBrowse.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            saveSelectedFile(prop);

            JFrame parentFrame = new JFrame();
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Specify a file to save");
            fileChooser.setMultiSelectionEnabled(true);

            int userSelection = fileChooser.showSaveDialog(parentFrame);

            if (userSelection == JFileChooser.APPROVE_OPTION) {
                fileToSave = fileChooser.getSelectedFiles();
                for (int i = 0; i < fileToSave.length; i++) {
                    File file = fileToSave[i];
                    String artifactpath = file.getAbsolutePath();

                    File f = new File(artifactpath);
                    String absolutefilename = f.getName();
                    String filename = ArtifactsDirectory.concat(absolutefilename);
                    CopyFile artifactcopy = new CopyFile(artifactpath, filename);
                    try {
                        artifactcopy.copy();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                }
                uploadedFiles();

                rowList = new JList(model);
                listScrollPane.setViewportView(rowList);
                panel.add(listScrollPane);

            }
            rowList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lblDelete.setVisible(true);
                }
            });

        }
    });
    btnNewButtonBrowse.setBounds(208, 335, 104, 23);
    contentPane.add(btnNewButtonBrowse);
    btnNewButtonBrowse.setOpaque(false);

    textFieldBrowser = new JTextField();
    textFieldBrowser.setBounds(208, 364, 441, 23);
    contentPane.add(textFieldBrowser);
    textFieldBrowser.setColumns(10);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(8, 437, 639, 24);
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    contentPane.add(progressBar);

    JLabel lblBrowserInformation = new JLabel("Browser Information");
    lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT);
    lblBrowserInformation.setLabelFor(textFieldBrowser);
    lblBrowserInformation.setBounds(32, 368, 174, 14);
    contentPane.add(lblBrowserInformation);

    panel = new JPanel();
    panel.setBounds(423, 325, 127, 33);
    contentPane.add(panel);
    panel.setLayout(null);

    listScrollPane = new JScrollPane();
    listScrollPane.setBounds(0, 0, 127, 33);
    panel.add(listScrollPane);

    lblDelete = new JLabel("");
    lblDelete.setBounds(552, 325, 22, 23);
    lblDelete.setVisible(false);
    lblDelete.setIcon(
            new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png")));
    contentPane.add(lblDelete);
    lblDelete.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?");
            if (option == JOptionPane.YES_OPTION) {
                String sel = rowList.getSelectedValue().toString();
                String selected = dir + "/" + sel;
                File fileExists = new File(selected);
                fileExists.delete();
                model.remove(sel.indexOf(sel));
                lblDelete.setVisible(false);

            }
        }
    });

    JLabel instalType = new JLabel("Installation Type : ");
    instalType.setBounds(32, 395, 177, 23);
    instalType.setVisible(true);
    contentPane.add(instalType);

    ButtonGroup btnGrp = new ButtonGroup();

    rdbtnInstaller = new JRadioButton("Installer");
    rdbtnInstaller.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Installer";
        }
    });
    rdbtnInstaller.setBounds(208, 395, 104, 23);
    rdbtnInstaller.setSelected(true);
    contentPane.add(rdbtnInstaller);
    btnGrp.add(rdbtnInstaller);

    rdbtnArchive = new JRadioButton("Archive");
    rdbtnArchive.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Archive";
        }
    });
    rdbtnArchive.setBounds(333, 395, 104, 23);
    contentPane.add(rdbtnArchive);
    btnGrp.add(rdbtnArchive);

    rdbtnManual = new JRadioButton("Manual");
    rdbtnManual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Manual";
        }
    });
    rdbtnManual.setBounds(460, 395, 127, 27);
    contentPane.add(rdbtnManual);
    btnGrp.add(rdbtnManual);

    JLabel lblBackground = new JLabel();
    lblBackground.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg")));
    lblBackground.setBackground(SystemColor.controlHighlight);
    lblBackground.setHorizontalAlignment(SwingConstants.CENTER);
    lblBackground.setBounds(0, 0, 659, 488);
    contentPane.add(lblBackground);
}

From source file:com.igormaznitsa.zxpoly.MainForm.java

private File chooseFileForSave(final String title, final File initial, final FileFilter filter) {
    final JFileChooser chooser = new JFileChooser(initial);
    chooser.addChoosableFileFilter(filter);
    chooser.setAcceptAllFileFilterUsed(true);
    chooser.setMultiSelectionEnabled(false);
    chooser.setDialogTitle(title);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    final File result;
    if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        result = chooser.getSelectedFile();
    } else {//from   w ww.  j  av a2s.  co m
        result = null;
    }
    return result;
}

From source file:com.igormaznitsa.zxpoly.MainForm.java

private File chooseFileForOpen(final String title, final File initial,
        final AtomicReference<FileFilter> selectedFilter, final FileFilter... filter) {
    final JFileChooser chooser = new JFileChooser(initial);
    for (final FileFilter f : filter) {
        chooser.addChoosableFileFilter(f);
    }/*from   w  w w  . j a v  a 2 s .  c o m*/
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setMultiSelectionEnabled(false);
    chooser.setDialogTitle(title);
    chooser.setFileFilter(filter[0]);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

    final File result;
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        result = chooser.getSelectedFile();
        if (selectedFilter != null) {
            selectedFilter.set(chooser.getFileFilter());
        }
    } else {
        result = null;
    }
    return result;
}