• 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

Save file dialog?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to open a JFileChooser that will check if selected file exists in selected directory and replace it or create a new one appropriately.

I got this far and got confused...


 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are we supposed to mind readers and guess what you got confused about?

 
Jacob Tyo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just don't understand writing to files.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well then forget about the JFileChooser and first learn how to write to files by hardcoding the file name. Then once you understand that you can use the file choose to get a dynamic file name because the writing to the file code will be exactly the same.

I don't see whats wrong with the code you posted, but if you need help then:

a) I suggest you read the section in your text book because I'm sure it has working examples.

b) If you don't have a text book then you can find example I/O examples in the Java tutorials..

If you need more help post your SSCCE.
 
Jacob Tyo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! This is might be what I need
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic