public void exit(SimpleFrame frame) 
	{
		File tempFile = new File(frame.fileName);
		if(tempFile.exists()) tempFile.delete();
		JFileChooser chooser = new JFileChooser();
		
		chooser.setCurrentDirectory(new File("."));
			
		if(frame.getIsChanged()) 
		{
			int selection = JOptionPane.showConfirmDialog(null,"Do you want save document?", "Warrning", JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
			
			if(selection == JOptionPane.NO_OPTION)	
			{
				try 
				{
					frame.getClient().close();
					frame.getPtr().Disconnect(frame.getProjName(), frame.getLogin());
				} 
				catch (RemoteException e1) 
				{
					JOptionPane.showMessageDialog(frame, "Disconect from Server");
					return;
				}
				System.exit(0);
			}
				
			if(selection == JOptionPane.YES_OPTION)
			{
				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();
					} 
					catch (IOException e) 
					{
						JOptionPane.showMessageDialog(frame, "Saving error");
					}
				}
				else
				{
					return;
				}
			}
		}
		else
		{
			try 
			{
				frame.getClient().close();
				frame.getPtr().Disconnect(frame.getProjName(), frame.getLogin());
			} 
			catch (RemoteException e1) 
			{
				JOptionPane.showMessageDialog(frame, "Disconect from Server");
				return;
			}
			System.exit(0);
		}
			
	}