public void savePreferences() {
		String empty = "";
		if(emptyString.equals(lambda)) empty = lambdaText;
	    else if(emptyString.equals(epsilon)) empty = epsilonText;
		
		DocumentBuilderFactory factory = DocumentBuilderFactory
		.newInstance();
		DocumentBuilder builder;
		try {
			File file = new File(pathToFile);
			
			builder = factory.newDocumentBuilder();
			Document doc = builder.newDocument();
			doc.appendChild(doc.createComment("Created with JFLAP "
					+ gui.AboutBox.VERSION + "."));
			// Create and add the <structure> element.
			Element structureElement = createElement(doc, STRUCTURE_NAME, null,
					null);
			doc.appendChild(structureElement);
			Element se = doc.getDocumentElement();		
			Element element = createElement(doc, EMPTY_STRING_NAME, null, ""+empty);
			se.appendChild(element);
			element = createElement(doc, TURING_FINAL_NAME, null, ""+transTuringFinal);
			se.appendChild(element);
			element = createElement(doc, UNDO_AMOUNT_NAME, null, ""+undo_num);
			se.appendChild(element);
			element = createElement(doc, ACCEPT_FINAL_STATE, null, ""+turingAcceptByFinalState);
			se.appendChild(element);
			element = createElement(doc, ACCEPT_HALT, null, ""+turingAcceptByHalting);
			se.appendChild(element);
			element = createElement(doc, ALLOW_STAY, null, "" + turingAllowStay);
			se.appendChild(element);
			
			DOMPrettier.makePretty(doc);
			Source s = new DOMSource(doc);
			Result r = new StreamResult(file);
			Transformer t;
			try {
				t = TransformerFactory.newInstance().newTransformer();
				try {
					t.transform(s, r);
				} catch (TransformerException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} catch (TransformerConfigurationException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			} catch (TransformerFactoryConfigurationError e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			
			
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}