• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

saving text file as html file

 
Greenhorn
Posts: 1
C++ Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I want to save selected text file as html file in target directory
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic