classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: JFileChooser.getSelectedFiles() fixlet


From: Mark Wielaard
Subject: [cp-patches] FYI: JFileChooser.getSelectedFiles() fixlet
Date: Mon, 11 Jul 2005 21:54:20 +0200

Hi,

While testing Jump a bit I noticed that you can call getSelectedFiles()
even if in single file selection mode. So this patch makes sure
getSelectedFiles() does return something in that case.

2005-07-11  Mark Wielaard  <address@hidden>

        * javax/swing/JFileChooser.java (getSelectedFiles): Return an one
        element array containing selectedFile if selectedFiles is null.

Several people on irc said that this was better then the current
implementation. So I committed it. I didn't really get much further with
gump though.

Committed,

Mark

--- javax/swing/JFileChooser.java       2 Jul 2005 20:32:47 -0000       1.12
+++ javax/swing/JFileChooser.java       11 Jul 2005 19:44:59 -0000
@@ -357,7 +357,11 @@
    */
   public File[] getSelectedFiles()
   {
-    return selectedFiles;
+    if (selectedFiles != null)
+      return selectedFiles;
+    if (selectedFile != null)
+      return new File[] { selectedFile };
+    return null;
   }

   /**

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]