🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12057

FileChooser Multi-select

#12057
From: Doug Bath
Date: Mon, 01 Mar 1999 00:00
21 lines
1245 bytes
Greetings
Can anyone tell me why the following doesn't work? I get an array length
of 0 no matter how many files I select. I am using jdk1.2.

        fileChooser = new JFileChooser();
        fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
        fileChooser.setCurrentDirectory(newFile("C:\\"));
        fileChooser.setMultiSelectionEnabled(true);

if(fileChooser.showOpenDialog(this)==JFileChooser.APPROVE_OPTION)
        {
            File[] fileList=fileChooser.getSelectedFiles();
            System.out.print(fileList.length);   // debugging step
always prints 0
            for(int i=0;i<fileList.length;i++)
                System.out.println(fileChooser.getName(fileList[i]));
        }

Any insights would be appreciated

Doug Bath
Technical Details
Message-ID: <36DB04FF.7D310ED6@agt.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,3e1ec1418daeb5d8,start
X-Google-Attributes: gid111d45,public
From: Doug Bath <dbath@agt.net>
Subject: FileChooser Multi-select
Date: 1999/03/01
Message-ID: <36DB04FF.7D310ED6@agt.net>
X-Deja-AN: 450111233
Content-Transfer-Encoding: 7bit
Organization: Another Netscape Collabra Server User
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing