title: saving file using JFileChooser at any location
body: <p>hello i am trying to save the file at location specified by Jfilechooser  the situation now is when user click on save the file is created on the project direction with the name title but what i need is to give the user option where to save the file and choose the name he like using JFileChooser</p>
  
  <pre><code>if(buttonPressed.equals(save)){
  
           File myFile = new File("title");
           final JFileChooser fc = new JFileChooser();
           int returnVal = fc.showSaveDialog(null);
           fc.setSelectedFile(myFile);
           if (returnVal == JFileChooser.APPROVE_OPTION) {
  
              try (PrintWriter writer = new PrintWriter(myFile)) {   
  
              for (int i =0 ; i&lt; cModel.getRowCount(); i++)
              {
                 sData.add(cModel.getValueAt(i, 1).toString());
                 eData.add(cModel.getValueAt(i, 2).toString());
                 tData.add(cModel.getValueAt(i, 3).toString());
                 writer.println(i+1 + "\n");
                 writer.println(sData.get(i)+" --&gt; " + eData.get(i));
                 writer.println(tData.get(i));
                 writer.println("\n");
              }
              }catch(FileNotFoundException ioEx){
  
              } 
  
           }
  
           }
  </code></pre>