posted 9 years ago
Welcome to the Ranch!
There are several things I don't understand there. First of all, what do you mean by "saving" a file? In many cases that means writing data from the application into a selected file; I can't tell if that's what you intended. There's no automatic way in Swing to do that, you have to write the code yourself which outputs the data.
Second, what do you mean by saving it "as HTML file"? A file isn't an HTML file unless it's formatted HTML data, starting with the <html> tag and so on. You can't take any old data and have it magically converted into an HTML file, if it wasn't HTML to start with then you have to do something to make it into HTML.
And third, what's that about a "target directory"? If you want the chooser to start by asking the user to select a file in a particular directory, then you'd use its setCurrentDirectory method to tell it what that directory is.