🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: File[] syntax, instantiating

#8286
From: Kevin Dwan
Date: Thu, 28 Sep 2000 00:00
43 lines
1968 bytes

Kevin Dwan wrote:

> I see from the JDK1.2 docs for javax.swing.JFileChooser that
>
>     File[] is  what getSelectedFiles() returns:
>
>     "Returns a list of selected files if the filechooser is set to allow
> multiselection."
>
> My intent is to do something like
>
>     File[] sourceFiles = new File[];
>     .
>     .
> and then, on the JFileChooser instance sfc,
>
> void sfc_actionPerformed(ActionEvent e)
>   {
>     int returnVal = sfc.showSaveDialog(this);
>       if (returnVal == JFileChooser.APPROVE_OPTION) {
>           sourceFiles = sfc.getSelectedFiles();
>       }
>       if (returnVal == JFileChooser.CANCEL_OPTION) {
>           //sfc.rescanCurrentDirectory();
>           sfc.getCurrentDirectory();
>       }
>   }
> So that on APPROVE, sourceFiles will hold an array of the filenames the
> user selected.(I'm assuming from the bracket syntax that an array is
> what the documentation means what it says,  "Returns a list...")
>
> I've never seen the File [] construct below and can't locate
> documentation on it.When I try to instantiate it with:
>     File[] sourceFiles = new File[];
> I get a compiler error, with focus between the closing bracket and the
> semicolon, of  '{' expected. Hunh?
>
> Advice would be much appreciated.

Apologies for my haste in posting this, and not understanding that File[] is
simply an array of File.
Technical Details
Message-ID: <39D3B4CD.EE4CAEC7@blueberry.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39D3A5A1.FD6E4403@blueberry.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,9d4063d5862b2219
X-Google-Attributes: gid111d45,public
From: Kevin Dwan <kevin@blueberry.com>
Subject: Re: File[] syntax, instantiating
Date: 2000/09/28
Message-ID: <39D3B4CD.EE4CAEC7@blueberry.com>
X-Deja-AN: 675273621
Content-Transfer-Encoding: 7bit
References: <39D3A5A1.FD6E4403@blueberry.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing