Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JFileChooser

Status
Not open for further replies.

mathuesh

Programmer
Mar 27, 2003
3
IN
how can i open a file through the JFileChooser or FileDialog?
 
JFileChooser chooser = new JFileChooser( new File("c:\defaultDirectory"));
chooser.setDialogType( JFileChooser.OPEN_DIALOG );
if ( chooser.showOpenDialog( parent ) == JFileChooser.APPROVE_OPTION)
{
File f = chooser.getSelectedFile();
}

parent is some component from your GUI. "When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top