package code;

import java.awt.FileDialog;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.UIManager;


@SuppressWarnings("unused")
public class SaveGame {
	
	private String _fileToWriteTo;
	
	public static void main(String[] args) throws IOException{
		
		SaveGame t = new SaveGame();
		t.writeNewFile();
		
	}
	
	public SaveGame() throws IOException{
	       try {
	            UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
	        } catch(Exception e) {
	            e.printStackTrace();
	        }
		JFrame j = new JFrame();
		FileDialog chooser = new FileDialog(j,"Save your file",FileDialog.SAVE);
		//FileDialog chooser = new FileDialog(j,"Save your file",FileDialog.LOAD);
		chooser.setDirectory("C:\\");
		chooser.setFile("*.txt");
		chooser.setVisible(true);
		String filename = chooser.getFile();
		String path = chooser.getDirectory();
		System.out.println(path);
		String filetoWrite = path + filename;
		_fileToWriteTo = filetoWrite;
		//File file = new File("/users/mkyong/filename.txt");
		
		String content = "YOOOOOOOOOOOOOOOOOOOOOOOo";
		File file = new File(_fileToWriteTo);
		FileWriter fw = new FileWriter(file.getAbsoluteFile());
		BufferedWriter bw = new BufferedWriter(fw);
		bw.write(content);
		bw.close();
		System.out.println("Done");
		
	}
	
	public void writeNewFile() throws IOException{
		
		
	}
	
}

@@ -184,43 +184,41 @@
 e;%0D%0A
+%0D%0A
 import 
-javax.swing.UIManager
+code.base.Board
 ;%0D%0A%0D%0A%0D%0A
+%0D%0A
 @Sup
@@ -267,16 +267,36 @@
 Game %7B%0D%0A
+%09private Board _b;%0D%0A
 %09%0D%0A%09priv
@@ -323,24 +323,26 @@
 iteTo;%0D%0A%09%0D%0A%09
+//
 public stati
@@ -391,20 +391,18 @@
 ion%7B%0D%0A%09%09
-%0D%0A%09%09
+//
 SaveGame
@@ -425,16 +425,18 @@
 e();%0D%0A%09%09
+//
 t.writeN
@@ -443,32 +443,34 @@
 ewFile();%0D%0A%09%09%0D%0A%09
+//
 %7D%0D%0A%09%0D%0A%09public Sa
@@ -476,16 +476,23 @@
 aveGame(
+Board b
 ) throws
@@ -511,187 +511,20 @@
 %7B%0D%0A%09
-       try %7B%0D%0A%09            UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());%0D%0A%09        %7D catch(Exception e) %7B%0D%0A%09            e.printStackTrace();%0D%0A%09        %7D
+%09_b = b;%0D%0A%09%09
 %0D%0A%09%09
@@ -531,16 +531,17 @@
 JFrame j
+f
  = new J
@@ -581,32 +581,33 @@
 new FileDialog(j
+f
 ,%22Save your file
@@ -1039,24 +1039,26 @@
 t%22);%0D%0A%09%09%0D%0A%09%09
+//
 String conte
@@ -1241,16 +1241,266 @@
 fw);%0D%0A%09%09
+for(int i = 0; i%3C20; i = i + 1)%7B%0D%0A%09%09%09for(int j = 0; j%3C20; j = j +1)%7B%0D%0A%09%09%09%09if(_b.getTile(i, j) == null)%7B%0D%0A%09%09%09%09%09bw.write(%22-%22);%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09else%7B%0D%0A%09%09%09%09%09_b.getTile(i, j).getChar();%0D%0A%09%09%09%09%09bw.write(_b.getTile(i, j).getChar());%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09//
 bw.write

Update SaveGame.java