🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

File[] syntax, instantiating

#8285
From: Kevin Dwan
Date: Thu, 28 Sep 2000 00:00
36 lines
1727 bytes
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.
Technical Details
Message-ID: <39D3A5A1.FD6E4403@blueberry.com>
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,9d4063d5862b2219,start
X-Google-Attributes: gid111d45,public
From: Kevin Dwan <kevin@blueberry.com>
Subject: File[] syntax, instantiating
Date: 2000/09/28
Message-ID: <39D3A5A1.FD6E4403@blueberry.com>
X-Deja-AN: 675250246
Content-Transfer-Encoding: 7bit
Organization: Another Netscape Collabra Server User
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing