aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes what is the actual use of getselecttedfile() method in jfilechooser ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "what is the actual use of getselecttedfile() method in jfilechooser ?" Watch "what is the actual use of getselecttedfile() method in jfilechooser ?" New topic
Author

what is the actual use of getselecttedfile() method in jfilechooser ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

see i know that getselectedfile returns the instance of the file but here i m saving a file offcource i m taking the file name from the user but why getselectedfile() method is used in this method
i understand that at the time of reading a file we ll need getselectedfile() to get the files instance so that we can read that file
but i didnt understand what the method is doing here
i mean getselectedfile() method


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4392
    
    8

How else do you know where to save the file, if you don't use getSelectedFile()? You're using a Save file dialog to allow the user to select a location, and that method tells you what they've chosen.
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Matthew Brown wrote:How else do you know where to save the file, if you don't use getSelectedFile()? You're using a Save file dialog to allow the user to select a location, and that method tells you what they've chosen.

you mean to say which location the user wants to save the file
the getselectedfile() that ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

Yes.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Minh Nam
Ranch Hand

Joined: Sep 10, 2011
Posts: 57
According to the Java doc:


public File getSelectedFile()

Returns the selected file. This can be set either by the programmer via setFile or by a user action, such as either typing the filename into the UI or selecting the file from a list in the UI.

Returns:
the selected file


Make a habit to read the Java doc may save our time!


Advanced java topics
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the actual use of getselecttedfile() method in jfilechooser ?