public void fileSave(SimpleFrame frame)
	{
		File tempFile = new File(frame.tempFileName);
		if(tempFile.exists()) tempFile.delete();
		if(!frame.getIsFileNameSetted())
		{
			JFileChooser chooser = new JFileChooser();
			
			chooser.setCurrentDirectory(new File("."));
				
			int result = chooser.showSaveDialog(null);
			if (result == JFileChooser.APPROVE_OPTION)
			{
				frame.fileName = chooser.getSelectedFile().getPath();
				PrintWriter out;
				try 
				{
					out = new PrintWriter(new FileWriter(frame.fileName));
					String str = frame.getText().getText();
					out.print(str);
					out.close();
					frame.setIsChanged(false);
				} 
				catch (IOException e) 
				{
					JOptionPane.showMessageDialog(frame, "Saving error");
				}
			}
		}
		else
		{
			PrintWriter out;
			try 
			{
				out = new PrintWriter(new FileWriter(frame.fileName));
				String str = frame.getText().getText();
				out.print(str);
				out.close();
			} 
			catch (IOException e) 
			{
				JOptionPane.showMessageDialog(frame, "Saving error");
			}
		}
		frame.setIsFileNameSetted(true);
		frame.setTitle("Text Editor - " + frame.fileName);
	}