JFileChooser file filter and view does not display Drive letters

This code displays only files that end in abc.xml, and directories. For example, "helloabc.xml" and directory "world" will display as hello and world, respectively.
However, I am surprised to find that the drive letters are not displayed at all. eg. C:
any insights?
thanks,
Anil
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileView;
public class NoDrive {
     protected static final String ABC_FILE_EXTN = "abc.xml";
     public String selectFile(String function){
          File file = null;
          JFileChooser fc = new JFileChooser();
          fc.setFileFilter(new FileFilter() {
               public boolean accept(File f) {
                    if (!f.isFile() || f.getName().endsWith(ABC_FILE_EXTN))
                         return true;                    
                    return false;
               public String getDescription() {
                    return "ABC files";
          fc.setFileView(new FileView() {
               public String getName(File f) {
                    String name = f.getName();
                    if (f.isFile() && name.endsWith(ABC_FILE_EXTN))
                         return name.substring(0, name.indexOf(ABC_FILE_EXTN));
                    return name;
          int returnVal = fc.showDialog(null, function);
          if (returnVal == JFileChooser.APPROVE_OPTION) {
               file = fc.getSelectedFile();
               return file.getName();
          return null;
     public static void main(String[] args) {
          (new NoDrive()).selectFile("Open ABC");
}

OK. Here's the correct code:
    fc.setFileView(new FileView() {
      public String getName(File f) {
        String name = f.getName();
        if (f.isFile() && name.endsWith(ABC_FILE_EXTN)){
          return name.substring(0, name.indexOf(ABC_FILE_EXTN));
        else{
          return super.getName(f);
    });

Similar Messages

  • I purchased a movie via Itunes and it does not display as a purchased item on my Apple TV yet A TV show I bought does.

    I purchased a movie via Itunes and it does not display as a purchased item on my Apple TV yet A TV show I bought does. The only way I can view it is if I turn on home sharing and the movie is downloaded to my PC. Is this normal?

    Welcome to the Apple Community.
    Perfectly normal, purchased items only applies to TV shows, the studios have not licensed movies for redownloading.

  • HT4157 I have an iPad 2 and it does not display the cellular data button under settings

    I have an iPad 2 and it does not display the cellular data button under settings.  It does display a Bluetooth button in its place. I have tried the reset but no luck

    Is the iPad the Cellular version? Does it have an active Data plan? Does it have a Sim card installed in inside it?

  • Error in Upload file-table or view does not exist-wwv_flow_file_objects$

    Hi,
    i am trying to upload a file and then store the contents of the file into one of my tables in the schema.I wrote one package for uploading the file and then a process to insert each record in the uploaded file to the table in my schema.When i try compiling the package it gives an error.
    PL/SQL: ORA-00942: table or view does not exist
    The name of the table is wwv_flow_file_objects$
    The package is as follows-
    CREATE OR REPLACE PACKAGE BODY Text_File_Pkg AS
    FUNCTION get_file_lines (
    p_file_name IN VARCHAR2,
    p_lines IN OUT line_tab_type,
    p_rec_sep IN VARCHAR2 DEFAULT dos_new_line
    ) RETURN INTEGER
    IS
    v_binary_file BLOB;
    v_text_file CLOB;
    v_dest_offset INTEGER := 1;
    v_src_offset INTEGER := 1;
    v_lang_context INTEGER := DBMS_LOB.default_lang_ctx;
    v_warning INTEGER;
    v_rec_sep_len CONSTANT INTEGER := LENGTH(p_rec_sep);
    v_start_pos INTEGER := 1;
    v_end_pos INTEGER := 1;
    v_line_num INTEGER := 1;
    v_file_length INTEGER;
    BEGIN
    IF p_file_name IS NULL
    THEN
    RETURN 1;
    END IF;
    IF p_rec_sep IS NULL
    THEN
    RETURN 2;
    END IF;
    SELECT blob_content
    INTO v_binary_file
    FROM wwv_flow_file_objects$
    WHERE NAME = p_file_name
    AND (mime_type = 'text/plain' OR mime_type = 'application/octet-stream')
    AND doc_size > 0;
    DBMS_LOB.createtemporary(v_text_file, TRUE);
    DBMS_LOB.converttoclob(v_text_file, v_binary_file,
    DBMS_LOB.lobmaxsize, v_dest_offset,
    v_src_offset, DBMS_LOB.default_csid,
    v_lang_context, v_warning);
    IF v_warning = DBMS_LOB.warn_inconvertible_char
    THEN
    -- Unable to convert file.
    RETURN 3;
    END IF;
    v_file_length := DBMS_LOB.getlength(v_text_file);
    LOOP
    EXIT WHEN v_start_pos > v_file_length;
    v_end_pos := DBMS_LOB.INSTR(v_text_file, p_rec_sep, v_start_pos);
    IF v_end_pos = 0
    THEN
    v_end_pos := v_file_length + 1;
    END IF;
    IF (v_end_pos - v_start_pos) > 4000
    THEN
    -- Line exceeds 4000 characters.
    RETURN 4;
    END IF;
    p_lines(v_line_num) := DBMS_LOB.SUBSTR(v_text_file, v_end_pos - v_start_pos, v_start_pos);
    v_line_num := v_line_num + 1;
    v_start_pos := v_end_pos + v_rec_sep_len;
    END LOOP;
    RETURN 0;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    RETURN 5;
    END get_file_lines;
    END Text_File_Pkg;
    Any suggestions.
    Many Thanks,
    Sanjai

    Hi,
    i am trying to upload a file and then store the contents of the file into one of my tables in the schema.I wrote one package for uploading the file and then a process to insert each record in the uploaded file to the table in my schema.When i try compiling the package it gives an error.
    PL/SQL: ORA-00942: table or view does not exist
    The name of the table is wwv_flow_file_objects$
    The package is as follows-
    CREATE OR REPLACE PACKAGE BODY Text_File_Pkg AS
    FUNCTION get_file_lines (
    p_file_name IN VARCHAR2,
    p_lines IN OUT line_tab_type,
    p_rec_sep IN VARCHAR2 DEFAULT dos_new_line
    ) RETURN INTEGER
    IS
    v_binary_file BLOB;
    v_text_file CLOB;
    v_dest_offset INTEGER := 1;
    v_src_offset INTEGER := 1;
    v_lang_context INTEGER := DBMS_LOB.default_lang_ctx;
    v_warning INTEGER;
    v_rec_sep_len CONSTANT INTEGER := LENGTH(p_rec_sep);
    v_start_pos INTEGER := 1;
    v_end_pos INTEGER := 1;
    v_line_num INTEGER := 1;
    v_file_length INTEGER;
    BEGIN
    IF p_file_name IS NULL
    THEN
    RETURN 1;
    END IF;
    IF p_rec_sep IS NULL
    THEN
    RETURN 2;
    END IF;
    SELECT blob_content
    INTO v_binary_file
    FROM wwv_flow_file_objects$
    WHERE NAME = p_file_name
    AND (mime_type = 'text/plain' OR mime_type = 'application/octet-stream')
    AND doc_size > 0;
    DBMS_LOB.createtemporary(v_text_file, TRUE);
    DBMS_LOB.converttoclob(v_text_file, v_binary_file,
    DBMS_LOB.lobmaxsize, v_dest_offset,
    v_src_offset, DBMS_LOB.default_csid,
    v_lang_context, v_warning);
    IF v_warning = DBMS_LOB.warn_inconvertible_char
    THEN
    -- Unable to convert file.
    RETURN 3;
    END IF;
    v_file_length := DBMS_LOB.getlength(v_text_file);
    LOOP
    EXIT WHEN v_start_pos > v_file_length;
    v_end_pos := DBMS_LOB.INSTR(v_text_file, p_rec_sep, v_start_pos);
    IF v_end_pos = 0
    THEN
    v_end_pos := v_file_length + 1;
    END IF;
    IF (v_end_pos - v_start_pos) > 4000
    THEN
    -- Line exceeds 4000 characters.
    RETURN 4;
    END IF;
    p_lines(v_line_num) := DBMS_LOB.SUBSTR(v_text_file, v_end_pos - v_start_pos, v_start_pos);
    v_line_num := v_line_num + 1;
    v_start_pos := v_end_pos + v_rec_sep_len;
    END LOOP;
    RETURN 0;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    RETURN 5;
    END get_file_lines;
    END Text_File_Pkg;
    Any suggestions.
    Many Thanks,
    Sanjai

  • I uploaded a new font and it does not display in firefox

    I have a website that uses a font that is not a standard "Microsoft" font - I uploaded the font to my computer and it displays just fine in Word and Open Office, but my website does not display it. How do I get FireFox to read the font file I just uploaded? I made certain that it IS available in the Windows\Fonts directory.

    Well, browsers only display "system fonts" unless, in Html 5 you establish the CSS @font to use other fonts.
    But, you are sounding like you are not doing that. When you design a webpage on YOUR PC *your* systems fonts will show properly ON YOUR PC because they are *your system* fonts that the browser can find... on *your* machine only.
    BUT, all other PCs/Macs/etc. probably do not have your font installed on their machines and the browser on their machines cannot find the named font, so it substitutes best guesses at it from the normally available generally available system fonts. So, when you create a webpage on *your* machine you WILL see what you are creating because THAT font is available to the browser... but only on YOUR machine.
    **** Only Solution **** is to use Html-5 @fonts CSS definitions BUT that too is tricky but works. Otherwise you get standard system fonts whether *your* machine displays properly or not.
    Hope this helps

  • Upgraded to 2.0.2 and Safari does not display iphone webpages

    Hi All,
    are you having the same problem? After upgrading to 2.0.2 Safari does not display for iphone formatted webpages in the right format anymore! Any idea what to do to overcome this situation (besides waiting for the next update?)
    Best Regards
    Christoph

    I am not seeing the problem at all.
    All the iPhone specific web pages I have tried work fine.
    Try a reset.

  • Firefox and Twitter and Finder does not display

    I have recently upgraded to Lion recently. The Transition was way rougher compare to the Snow Leopards.
    I am running a MBP 15", 2009 Mid-2009 version.
    It has 2 graphic cards on board, 9400m and 9600GT.
    When I first launched Lion, I was quite shock that my Firefox and Twitter do not display at all.
    After tweaking the system preferences, I realized that when the 9400m graphic card is activated, there isn't any display on several of the Applications,
    including the popular ones like Finder, Twitter and Firefox. The issues are fix when I switch to my 9600GT graphic card.
    Do any of you have the same issues that I am facing?
    I do hope Apple resolves these issues quickly.
    As using my 9600GT graphic translate to very bad battery life and a very warm laptop! I am not happy at paying $29.99 for something that breaks.

    Hey kennychan,
    I've had the same problem. I've done a clean re-install on a reformatted drive and the problem was gone. If you can do a clean reinstall I recommend you give it a shot.
    Best wishes,
    Dmitry

  • Insert PDF with Flash into another PDF and it does not display.

    When attempting to insert an Adobe Acrobat file with flash elements into another Adobe Acrobat file, the latter will not display the file on screen. Instead it shows this message "For the best experience, open this PDF portfolio in Acrobat X or Adobe Reader X, or later." Please help.

    Yes I would have thought so. Adobe Acrobat and Reader have the ability to view flash content items however this is not the case. I will explain step by step what I am doing. I have done this for years before and I have recently formatted my computer and had to reinstall the software.
    Here is a little background information:
    System:
    Windows 7 Professional 64bit
    AMD-FX 4100 Quad Core CPU
    8GB RAM
    250GB free on HDD
    Software Installed:
    Adobe Acrobat X Pro
    Adobe Reader XI
    Adobe Flash 17.0.0.134
    Microsoft Office Home and Business 2010
    Steps taken:
    Open Outlook
    Select a few messages
    Click on Convert to Adobe PDF
    Save the new file "toInsert.pdf"
    Open "main.pdf" file
    Click and drag "toInsert.pdf" file from desktop into the thumbnail area of the "main.pdf" file to insert.
    Attached Error. Please advise. Thank you.

  • "File Path and Name" field not displaying correctly

    Post Author: DaveWoo
    CA Forum: General
    Hello,Here's my situation: I'm currently upgrading from Crystal Reports for Visual Studio .NET 2003 to Crystal Reports for Visual Studio 2005. I have several reports (programmatically generated using VB.NET) that use the "File Path and Name" special field. Now, in the old version of Crystal Reports (2003), the field properly displayed the original file path and name; however, in the new version (2005), the field displays as "C:\DOCUME1\Username\LOCALS1\Temp\Filename{F2459406-3719-4C8B-917C-4A7055A18C76}.tmp" - in other words, the location of the temporary .rpt file.How do I get the "File Path and Name" field to correctly display the path & name of the original file, like it did in the prior version?- Dave

    This is a known issue tracked under ADAPT0000962216. At this time I do not know when this will be resolved, however Service Pack 2 for CR 2008 is targeted to be released by September and this may contain the fix.
    Ludek

  • Photo title and description does not display

    I have a site created in dreamweaver, I used photoshop to
    create a web photo gallery. The title and description although
    entered as file info and directly as html will not display when the
    gallery is loaded. Help please?? Is there a script problem? Here is
    a link
    http://www.clwhome.com/albums/gym2005_6/index.htm

    Actually the title and description do appear for a split
    second and the
    vanish.
    The information is there and can be seen if you look at the
    page outside the
    frameset.
    http://www.clwhome.com/albums/gym2005_6/pages/0226wolves04.htm
    Might be better asked in the PhotoShop Forum.

  • Tables and Views are not displaying any objects.

    I have tried both Filtered and non-filtered for tables and view but it won't list any tables or view.
    I can run a query and it shows all the tables/views in the query window.
    SELECT table_name  FROM dba_tables
    select view_name from all_views

    Who owns the objects?  
    The browser only shows objects owned by the current logged in user in the main section.  You need to go into the Other Users node to find objects owner by other users.

  • Results view does not display any data

    Hi
    Every time I execute a query in the sql worksheet, I do not see anything in the results view. I only see the ouput in the output script folder. The output script view display is just like the usual sqlplus screen results. I want to look at the results in a table format that is suppose to be displayed in the results view.I used F5 and F9 to execute the query.
    Can anyone tell me why this is so?
    Example below is what I see in the output script view, when I run the query below.
    select file_name,tablespace_name from dba_data_files;
    FILE_NAME
    D:\ORACLE\ORADATA\ORA92\SYSTEM01.DBF
    D:\ORACLE\ORADATA\ORA92\UNDOTBS01.DBF
    D:\ORACLE\ORADATA\ORA92\CWMLITE01.DBF
    D:\ORACLE\ORADATA\ORA92\DRSYS01.DBF
    D:\ORACLE\ORADATA\ORA92\EXAMPLE01.DBF
    D:\ORACLE\ORADATA\ORA92\INDX01.DBF
    D:\ORACLE\ORADATA\ORA92\ODM01.DBF
    D:\ORACLE\ORADATA\ORA92\TOOLS01.DBF
    D:\ORACLE\ORADATA\ORA92\USERS01.DBF
    D:\ORACLE\ORADATA\ORA92\XDB01.DBF
    D:\ORACLE\ORADATA\ORA92\TEST01.DBF
    11 rows selected.
    I want to be able to see the results in the results view in a table format. Why is this not happening?
    Thanks.

    It works for me, when I use F9. Ensure you select the statement (unless it's the only statement) then press F9, or click the triangle button.
    I guess it makes sense for F5, or execute script, to not show a table as there may be many selects, and other statements, in a script and there is no specific return value from a script.
    Message was edited by:
    TonyW

  • The website takes a long time to lod and it does not display correctly the layout is expanded.

    When i try to load the website it takes a long time to load and when it does the layout is expanded and no images appear. The site has the same problems with IE and chrome. I did recently use Reginout.

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.
    Did you check the Accessibility settings in Windows?
    *http://windows.microsoft.com/en-US/Windows7/Make-the-computer-easier-to-see-optimize-visual-display
    *http://windows.microsoft.com/en-US/windows7/Getting-the-best-display-on-your-monitor

  • Iphone 5,Facebook app, time and battery % does not display?

    Using iphone 5, Facebook app, why does the time and battery percentage no longer display?

    First, double-tap the home button and then swipe up on the FB app to close it out.  Then, try again.  Second, delete the FB app and then reinstall it and see if that resolves the issue.

  • Adobe Bridge CS3 - does not display thumbnails for Canon 40D or 50D RAW files

    I wanted to use Bridge to view my Canon EOS 50D RAW files and it does not display the thumbnails, just icons. I checked my 40D cr2 files and saw same thing.
    I have purged the cache and rest the cache preferences and it has not helped. I would like to be abl eto view the thumbnails of the RAW files via Bridge if possible. Jpg files and Tif files can be viewed without any issues.
    Am using Bridge version 2.1.1.9 and Pshop CS3 10.0.1

    I have the exact same problem. I can view my RAW file thumbnails (which are .ARW files from my Sony A200 camera) in the Finder and in other applications, such as Preview, but not in Adobe Bridge CS3. I know that I did try purging the cache at one point to see if that would fix it, but then I didn't know what to do after that. Before I purged the cache, I was able to view RAW thumbnails in Bridge, but then they would not increase in size when I tried using the slider (at the bottom right of the Bridge window)

Maybe you are looking for

  • Tax Condition ZSRT not showing in Print Preview and Tax Register

    Dear Friends while we making Purchase Order the Tax condition not showing while print preview.  also not showing in Tax Register. Tax Register we developed. any hops Rajesh G

  • How to drag and drop a picture into a mask?

    I have a text box which has a masked photo in it. I used to be able to click on a picture in my web browser, drag it over to iWeb, and drop it into the mask with one quick and easy motion. I made some changes to my web site and now I can not do this

  • Acrobat 9 Redaction Formatting Error Problem

    I have XP Pro and running trial version of 9 Pro. I am using a document converted from Word to PDF. When I apply redactions and save document some of the formatting (like paragraph indents and spacing including spacing within a word) become erratic t

  • ECCS Reclassification by Partner unit for a Set of Accounts

    Hello Guys, I want to reclassify a SET OF ACCOUNTS by Partner unit. Let say that I have 3 accounts and 2 partner unit for the same entity as follows: Entity A Account 1:  1000 Euros with Partner Unit a Account 1:    500 Euros with Partner Unit b Acco

  • Photo quality needed for iMovie?

    Hello all, I'm VERY new to iMovie! I'm trying to import photos in iMovie from iPhoto and wondering if keeping them their original size (sometimes 25 MB) is okay? Or do I need to MODIFY all the photos I want to put into a different resolution/size? If