Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2005

Tip: Looking for answers? Try searching our database.

getParentDirectory

Thread view: 
Huub - 26 Oct 2005 19:58 GMT
Hi,

According to the API, getParentDirectory(File dir) returns the parent
directory of dir. Does this mean that if I look for a filename "dir", it
will return the name of the directory in which the file is?

Thanks

Huub
Andrey Kuznetsov - 26 Oct 2005 22:54 GMT
> According to the API, getParentDirectory(File dir) returns the parent
> directory of dir. Does this mean that if I look for a filename "dir", it
> will return the name of the directory in which the file is?

why don't you try it and tell us the result?

Signature

Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Roedy Green - 26 Oct 2005 23:14 GMT
>According to the API, getParentDirectory(File dir) returns the parent
>directory of dir. Does this mean that if I look for a filename "dir", it
>will return the name of the directory in which the file is?

Have you tried it?

Can you think of any alternative plausible behaviour?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Huub - 27 Oct 2005 19:23 GMT
> Have you tried it?
>
> Can you think of any alternative plausible behaviour?

I'm trying to, but I have a conversion question. I'm reading String from
keyboard, which I convert to File:

String tvps = tvpatroon.getText();
FileSystemView fsv;
File file = fsv.createFileObject(tvps);

Then I have to convert it back to String in order to display it with
JOptionPane. Is there a simpler way to do this?
Roedy Green - 28 Oct 2005 08:12 GMT
>Then I have to convert it back to String in order to display it with
>JOptionPane. Is there a simpler way to do this?

File has all sorts of toString style methods.  For a summary of them
see http://mindprod.com/jgloss/file.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 28 Oct 2005 18:09 GMT
>> Have you tried it?
>>
[quoted text clipped - 9 lines]
> Then I have to convert it back to String in order to display it with
> JOptionPane. Is there a simpler way to do this?

   I don't think it gets much easier than a single method call:

fsv.getName();

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.