Here you can find the source of writeOnFile(String row)
public static void writeOnFile(String row)
//package com.java2s; //License from project: Open Source License import java.io.*; import javax.swing.JFileChooser; public class Main { public static void writeOnFile(String file_name, String row) { File outFile = new File(file_name); FileWriter out;//from w ww . j av a 2 s. c om try { out = new FileWriter(outFile, true); out.write(row); out.close(); } catch (IOException e) { } } public static void writeOnFile(String row) { writeOnFile(getFileFromChooser().getAbsolutePath(), row); } public static File getFileFromChooser() { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("save as file"); chooser.setSize(new java.awt.Dimension(45, 37)); // Generated // chooser.setFileFilter(new FileNameExtensionFilter("png", "png")); File file = null; if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); return file; } return file; } public static File getFileFromChooser(String folderPath) { JFileChooser chooser = new JFileChooser(folderPath); chooser.setDialogTitle("save as file"); chooser.setSize(new java.awt.Dimension(45, 37)); // Generated // chooser.setFileFilter(new FileNameExtensionFilter("png", "png")); File file = null; if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); return file; } return file; } }