I've tried:
Where server and port are JTextAreas holding the server and port, and configL is the label for the window. The label's set to "Save Successful.", but the file is blank after this runs. Can someone please tell me why?Code:connPort = port.getText(); serverIP = server.getText(); configF.setVisible(false); try { BufferedWriter w = new BufferedWriter(new FileWriter(new File("sys/conf.txt"))); w.write(server.getText().concat("\n")); w.write(port.getText()); w.write("This works!"); configL.setText("Save successful."); } catch(Throwable t) { configL.setText("Save unsucessful."); }
EDIT 2: Above problem has been fixed. w.close(); Heh.
EDIT: configF is the JFrame holding all of this, and it should dissappear when I call configF.setVisible(false); but it doesn't. How should I go about making it dissappear?


Reply With Quote


Bookmarks