Advertisement
Guest User

Untitled

a guest
May 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package text.editor.pkgfinal.project;
  7.  
  8. import java.io.FileWriter;
  9. import java.io.IOException;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import javax.swing.JFileChooser;
  13.  
  14. /**
  15. *
  16. * @author raige
  17. */
  18. public class SaveAs {
  19. public void saveAs(String value,JFileChooser saveOption){
  20.  
  21. try(FileWriter fw = new FileWriter(saveOption.getSelectedFile()+".txt")) {
  22.  
  23.  
  24. fw.write(value);
  25. } catch (IOException ex) {
  26. Logger.getLogger(SaveAs.class.getName()).log(Level.SEVERE, null, ex);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement