Package javax.swing

Examples of javax.swing.JFileChooser.showDialog()


  public boolean promptForIdentity(String message) {   
    final JFileChooser fc = new JFileChooser();
    fc.setCurrentDirectory(new File("."));
    fc.setDialogTitle(message);
    fc.setFileHidingEnabled(false);
    int response = fc.showDialog(null, "Select");
    if (response == JFileChooser.APPROVE_OPTION) {
      identity = fc.getSelectedFile().getAbsolutePath();
      return true;
    }
    return false;
View Full Code Here


        }

        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setSelectedFile(new File(filename));

        int chooseResult = fileChooser.showDialog(component, "Download");
        if (chooseResult == JFileChooser.APPROVE_OPTION) {
            try {
                storeStream(content.getStream(), fileChooser.getSelectedFile());
            } catch (Exception e) {
                showError(component, e);
View Full Code Here

    public static void copy(Component component, File file) {
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setSelectedFile(new File(file.getName()));

        int chooseResult = fileChooser.showDialog(component, "Download");
        if (chooseResult == JFileChooser.APPROVE_OPTION) {
            try {
                storeStream(new FileInputStream(file), fileChooser.getSelectedFile());
            } catch (Exception e) {
                showError(component, e);
View Full Code Here

                retVal = filePanel.showSaveDialog(mainWindow);
                break;
            case DIRECTORY:
                filePanel.setDialogType(JFileChooser.SAVE_DIALOG);
                filePanel.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                retVal = filePanel.showDialog(mainWindow, "Select");
                break;
        }
        if (retVal == JFileChooser.APPROVE_OPTION)
        {
            if (multiple) getInstance().files = filePanel.getSelectedFiles();
View Full Code Here

    JFileChooser fileChooser = new JFileChooser();
    if(currentPath!=null) {
      fileChooser.setCurrentDirectory(currentPath);
    }

    int result = fileChooser.showDialog(null,actionText);
    fileChooser.setVisible(true);
   
    if(result == JFileChooser.APPROVE_OPTION) {
      currentPath = fileChooser.getCurrentDirectory();
      return fileChooser.getSelectedFile().getAbsolutePath();
View Full Code Here

    String downloadFolder = ".";
    if(gui) try {
      JFileChooser jfc = new JFileChooser();
      jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      if(jfc.showDialog(null, "Install Here") != JFileChooser.APPROVE_OPTION)
        System.exit(0);
      downloadFolder = jfc.getSelectedFile().getAbsolutePath();
    } catch(Exception e) {
      Out.info(InstallMain.class, "GUI failed to initialize, disabling.");
      gui = false;
View Full Code Here

     
      @Override
      public void actionPerformed(ActionEvent arg0) {
        JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir"));
       
        int returnVal = fileChooser.showDialog(GraphPanel.this, "Save");
       
        if (returnVal == JFileChooser.APPROVE_OPTION)
        {
          File file = fileChooser.getSelectedFile();
          try {
View Full Code Here

      fileChooser.setCurrentDirectory(m_currentDirectory);
    }
   
    fileChooser.setFileFilter(new XMLFileFilter());

    int result = fileChooser.showDialog(this,null);
    if (result==fileChooser.APPROVE_OPTION)
    {
      m_currentDirectory = fileChooser.getCurrentDirectory();
      rc = fileChooser.getSelectedFile();
    }
View Full Code Here

      fileChooser.setCurrentDirectory(m_currentDirectory);
    }
   
    fileChooser.setFileFilter(new XMLFileFilter());

    int result = fileChooser.showDialog(this,null);
    if (result==fileChooser.APPROVE_OPTION)
    {
      try
      {
        m_currentDirectory = fileChooser.getCurrentDirectory();
View Full Code Here

            public String getDescription() {
                return "Office Documents";
            }
        });
       
        int result = chooser.showDialog(null, null);
       
        if (result == JFileChooser.APPROVE_OPTION) {
            target = chooser.getSelectedFile();
        }
        return target;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.