• 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

JFileChooser

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I'm sure this question must have been asked before and there are lots of demos concerning the use of file choosers but could someone give me some advise, or link, as to how:

I can use a JFileChooser in netbeans such that when I press the 'Open' button I can get the absolute path of the file sent to a variable.

Cheers
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't use the JFileChooser in NetBeans; you use it in Java.

I would have thought the easiest things to do is to get a File object from the getSelectedFile() method of JFileChooser, then get the path from a method like this one,

Have you read the Java Tutorial page about File Choosers?
CR
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your advice. I tried looking at the Sun website that detailed JFileChooser last night but it seemed like the website went down or something....

Thanks again
 
reply
    Bookmark Topic Watch Topic
  • New Topic