How to read the text shown in the "Look in" field in a JFileChooser?

Hello,
I work on a windows environment and I have a network drive mapped on my computer.
The mapped network drive letter is: X:\
When I open the JFileChooser and point to this drive and choose it ,in the JFileChooser's "Look in" field this is what is written: Version6.1 on server(X:) but when I choose it and print the pathName it returns only the mapped network drive letter (i.e. X:\) (which is of course understandable).
The user wants to see the name of the folder he has chosen and not just the drive's letter.
How can I possibly get the exact test shown in the JFileChooser before returning?
Thanks.

>
When I open the JFileChooser and point to this drive and choose it ,in the JFileChooser's "Look in" field this is what is written: Version6.1 on server(X:) but when I choose it and print the pathName it returns only the mapped network drive letter (i.e. X:\) (which is of course understandable).
The user wants to see the name of the folder he has chosen and not just the drive's letter.
How can I possibly get the exact test shown in the JFileChooser before returning?
>
Your question is confusing. If the user chose a folder then they will see the name of the folder and the full path.
You might be referring to the system display name for the drive itself. If that is what you want you will need to add code to get that name and display it to the user. The dialog isn't going to include the display name.
For example if I map drive z to the c drive of another machine I can get that drive name the way it is displayed:
restoreFolderChooser.getFileSystemView().getSystemDisplayName(new File("z:\\"))
"c$ on 'blade1' (Z:)"Is that was you are looking for?
See the FileSystemView class in the Javadocs
http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/filechooser/FileSystemView.html
>
getSystemDisplayName
public String getSystemDisplayName(File f)Name of a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "M:\" directory displays as "CD-ROM (M:)" The default implementation gets information from the ShellFolder class.
Parameters:
f - a File object
Returns:
the file name as it would be displayed by a native file chooser
See Also:
JFileChooser.getName(java.io.File)

Similar Messages

  • How to read two text files using the Read from spreadsheet.vi and then plot it

    I need to read two text files using the read from spreadsheet function and then plot these files over time.
    The file with the .res extention is the RMS values (dt and df) and the second file contains the amplitude of a frequency spectrum.
    I really appreciate any help..thanks
    Attachments:
    RMS.txt ‏1 KB
    FREQUENCY.txt ‏1 KB

    From NI Example Finder:
    Write to Text File.vi
    Read from Text File.vi
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

  • Screen icons are huge.  I can't read my text messages and the whole screen page won't display.  How do I restore the phone screen to it's natural setting?

    Screen icons are huge.  I can't read my text messages and the screen page won't fully display to view. How do I restore the phone screen to it's natural setting.

    Thanks.

  • Does anyone know how to do a text search in the new Safari for iPad iOS 7?

    Does anyone know how to do a text search in the new Safari for iPad iOS 7?

    The feature has been removed to make safari even less useable. You need to download a third party browser like atomic web browser to get the functionality you want back.
    Like many new IOS 7 "features", safari on the ipad is a FAIL.
    At least you can now bury safari in a folder containing hundreds of icons that you can only view 9 at a time.

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

  • How to download a text file from the server

    hi everyone,
    can anyone tell me how to download and read a text file from the server and saved in into resource folder.
    with regards
    pallavi

    its really easy
    To read from server, use something like:
    HttpConnection connector = null;
    InputStream inp_stream = null;
    OutputStream out_stream = null;
    void CloseConnection()
         if(inp_stream!=null)inp_stream.close();
         inp_stream=null;
         if(out_stream!=null)out_stream.close();
         out_stream=null;
         connector.close();
         connector = null;
    public void getResponse(String URL,String params)
      try
         if(connector==null)connector = (HttpConnection)Connector.open(URL);//URL of your text file / php script
         connector.setRequestMethod(HttpConnection.POST);
         connector.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
         connector.setRequestProperty("content-type", "application/x-www-form-urlencoded");
         //connector.setRequestProperty("charset","windows-1251");
         //*** If you need to send ("arg1=value&arg2=value") arguments to script use this:
         out_stream = connector.openOutputStream();
         byte postmsg[] = params.getBytes();
         out_stream.write(postmsg);
         int rc = connector.getResponseCode();//in any case here connection will be opened & closed
         if (rc != HttpConnection.HTTP_OK)
              CloseConnection();
              throw new IOException("HTTP response code: " + rc);
         inp_stream = connector.openInputStream();
         int pack_len = inp_stream.available();
         byte answ[]=new byte[pack_len];
         inp_stream.read(answ);
         CloseConnection();
         ProcAnswer(answ);//process received data
      catch(Exception ex)
         System.err.println("ERROR IN getResponse(): "+ex);
    } And you can read from resource file like
    public void loadFile(String filename)
        DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/"+filename));
        String str="";
        try
             while (true)
                ch = dis.read();//read character
                if(ch=='\r')continue;//if file made in windows
                if(ch=='\n' || ch==-1)//end of line or end of file
                    if(str.length()==0)continue;//if empty line
                    //do some thing with "str"
                    if(ch==-1)break;//it was last line
                    str="";//next line
                    continue;
                 str+=(char)ch;
           dis.close();
       catch (Exception e)
           System.err.println("ERROR in loadFile() " + e);
    }Welcome! =)
    Edited by: MorskoyZmey on Aug 14, 2008 3:40 AM

  • How can i use text expander with the new Mavericks,

    how can i use text expander with the new Mavericks,

    I regret upgrading to mavericks for the same reason
    ftamez wrote:
    how can i use text expander with the new Mavericks,
    Now I have been searching - and you have to buy an app and it will cost you $34.99 (what a rip off)

  • This is my first use of this program. How do I remove a page break? How do line up my drop down box along side the text box on the left of it? The drop down is for a multiple choice answer for the question to the left.

    This is my first use of this program. How do I remove a page break? How do line up my drop down box along side the text box on the left of it? The drop down is for a multiple choice answer for the question to the left of each drop down.

    See McAfee support to find out how to disable that McAfee feature - that isn't part of the normal Firefox installation.

  • I entered a new calendar event at I cloud on my laptop.  The enent showed up on my I Phone  4S but, the start and finish times on the entry in I cloud was different than the times shown on the I phone calendar.  How do I sync the time in my I Phone with

    I entered a new calender event using I cloud on my laptop. The enent transfered to my i Phone 5 S but, the start and finish times shown st i cloud on the laptop are different than the times shown on the i phone.  How do I sync the times on the i Phone with the times shown on the laptop i cloud calender?

    Turn off time zone support on the phone.

  • How to add a text box in the layout (View)

    How to add a text box in the layout (View)

    Hi.
    Right Click in the RootUIElement container.
    Click Insert Element.
    Give Name: Input
    Type : Input Field.
    Press Enter.
    Regards
    Bala.

  • Am new at pages and cannot figure out how to insert a bullet where I want it in the text, not at the beginning of the paragraph.  Word was much easier for me

    Am new at this forum and also at pages and can't figure out how to insert a bullet where I want it in the text, not at the beginning of the paragraph.  I found word much easier to use.  Please help. Trying to do a resume.

    On a US keyboard it is Option + 8 (above the letters). •

  • How do you change the text font on the Droid Global Phone

    How do you change the text font on the Droid Global Phone. I would like it to be darker (like bold)

    Hi.  
    Below I have provided you with the steps to change your font settings.
    From the main menu
    Select Settings
    Select Display Settings
    Select Font Style
    You can select from what is available, 
    Or you select [Get Fonts Online] to find something you want.
    Thank you,

  • I had set my passcode by pressing 1 repeatedly till it filled the passcode box. I dont know how many times I have pressed 1. Can someone tell me the character length of the text box of the Passcode

    Hi,
    My son foolishly pressed a single digit till it just filled the text box of the passcode. Now i dont know how many times he has pressed it. If I can know the charcter length, or how many digits can just fill the text box of passcode, I can unlock my ipad2. If anyone reading this has ipad2, he can do the same thing and count how many digits will just fill the text box. I will really appreciate the help.
    Thanks

    You can put the iPad into Recovery mode and Restore it. See this link and note the sentence commencing, 'If you restore from a different computer.... ' down near the bottom of the page.
    http://support.apple.com/kb/HT1808

  • HOW to make a text apper from the other side in a Textfield

    am trying to allow the text come from the other side in a textfield. eg..look at the caculator on your windows OS. see how the textfield appears from the left. any suggestions.???

    this are the errors on ur code
    even after i imported javax.swing.text
    NoteSizeFilter.java:2: cannot find symbol
    symbol: class DocumentFilter
    public class NoteSizeFilter extends DocumentFilter {
    ^
    NoteSizeFilter.java:14: cannot find symbol
    symbol : class FilterBypass
    location: class NoteSizeFilter
    public void insertString(FilterBypass fb, int offs, String str, AttributeSet a)
    ^
    NoteSizeFilter.java:14: cannot find symbol
    symbol : class AttributeSet
    location: class NoteSizeFilter
    public void insertString(FilterBypass fb, int offs, String str, AttributeSet a)
    ^
    NoteSizeFilter.java:15: cannot find symbol
    symbol : class BadLocationException
    location: class NoteSizeFilter
    throws BadLocationException {
    ^
    NoteSizeFilter.java:23: cannot find symbol
    symbol : class FilterBypass
    location: class NoteSizeFilter
    public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a)
    ^
    NoteSizeFilter.java:23: cannot find symbol
    symbol : class AttributeSet
    location: class NoteSizeFilter
    public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a)
    ^
    NoteSizeFilter.java:24: cannot find symbol
    symbol : class BadLocationException
    location: class NoteSizeFilter
    throws BadLocationException {
    ^
    NoteSizeFilter.java:16: operator + cannot be applied to FilterBypass.getDocument.getLength,int
    if ((fb.getDocument().getLength() + str.length()) <= maxCharacters) {
    ^
    NoteSizeFilter.java:16: operator <= cannot be applied to <nulltype>,int
    if ((fb.getDocument().getLength() + str.length()) <= maxCharacters) {
    ^
    NoteSizeFilter.java:17: cannot find symbol
    symbol : variable super
    location: class NoteSizeFilter
    super.insertString(fb, offs, str, a);
    ^
    NoteSizeFilter.java:25: operator + cannot be applied to FilterBypass.getDocument.getLength,int
    if ((fb.getDocument().getLength() + str.length() - length) <= maxCharacters) {
    ^
    NoteSizeFilter.java:25: operator - cannot be applied to <nulltype>,int
    if ((fb.getDocument().getLength() + str.length() - length) <= maxCharacters) {
    ^
    NoteSizeFilter.java:26: cannot find symbol
    symbol : variable super
    location: class NoteSizeFilter
    super.replace(fb, offs, length, str, a);
    ^
    NoteSizeFilter.java:28: cannot find symbol
    symbol : variable super
    location: class NoteSizeFilter
    super.replace(fb, offs, length, str, a);
    ^
    NoteSizeFilter.java:31: cannot find symbol
    symbol : variable super
    location: class NoteSizeFilter
    super.replace(fb, 0, fb.getDocument().getLength(), parsed, a);
    ^
    15 errors
    C:\Java Files\GUI\Calculator>

  • (Enter the text shown) why this showing in firefox persona sign in, there is no text???

    Enter the text shown why this showing in Firefox persona sign in

    That is a CAPTCHA from https://api-secure.recaptcha.net
    Make sure that you do not block that image.
    You can check if you can see that image in Tools > Page Info > Media
    See also:
    [[Images or animations do not show]]
    [[Websites look wrong]]

Maybe you are looking for