Hi,
I am very new to GUI and I've been experimenting with JFileChooser lately. I can choose a text file using JFileChooser and display it in a JTextArea. The problem is I don't know how to the opposite. Probably by obtaining some text from a JTextArea, storing it as a
String and then using JFileChooser to navigate through system files, type in a file name, and have the chooser "Create" a file with the name that I specify and then writing the String to it.
Here is what I've don so far. I'm a noob to all of this and you help will be greatly appreciated.
final JFileChooser fc = new JFileChooser() ;
int returnVal = fc.showSaveDialog(jDesktopPane1) ;
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File current_file = fc.getCurrentDirectory() ;
try{current_file.createNewFile() ;}
catch(Exception e) {System.out.println("Somethin' went wrong") ;}
this does not seem to work!!