File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes directory structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "directory structure" Watch "directory structure" New topic
Author

directory structure

kalai sundar
Ranch Hand

Joined: May 25, 2005
Posts: 69
my problem is

int fc=FileChooser.showOpenDialog(this);
if(fc==0)
{
fil=FileChooser.getCurrentDirectory();
String str=fil.getAbsolutePath();
txtFileLoc.setText(str);
}
when i use the above mention code, i am editing the directory path as for eg
e:\sample\new.class.But i don't want like that, i want to edit as e:\sample, But i coudn't vat should i do. plz hepl me

kalai
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8910
    
    8

So you want to select a directory? Looking at the Java API documentation for javax.swing.JFileChooser, you'll see there's a method setFileSelectionMode:

public void setFileSelectionMode(int mode)

Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories. The default is JFilesChooser.FILES_ONLY.

Parameters:
mode - the type of files to be displayed:

* JFileChooser.FILES_ONLY
* JFileChooser.DIRECTORIES_ONLY
* JFileChooser.FILES_AND_DIRECTORIES

Throws:
IllegalArgumentException - if mode is an illegal file selection mode
See Also:
getFileSelectionMode()



"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: directory structure