This patch allows directories to be selected in JFileChooser unless the
mode is FILES_ONLY.

I'm not closing the bug because there are some smaller details I want to
investigate (such as updating the filename text box when you select a
file/directory).

Patch attached.

2005-07-08  Anthony Balkissoon  <[EMAIL PROTECTED]>

* javax/swing/plaf/basic/BasicFileChooserUI.java:
(ApproveSelectionAction.actionPerformed): Allow directories to be
selected unless selection mode is FILES_ONLY.

-Tony
Index: javax/swing/plaf/basic/BasicFileChooserUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,v
retrieving revision 1.5
diff -u -r1.5 BasicFileChooserUI.java
--- javax/swing/plaf/basic/BasicFileChooserUI.java	2 Jul 2005 20:32:50 -0000	1.5
+++ javax/swing/plaf/basic/BasicFileChooserUI.java	8 Jul 2005 15:42:56 -0000
@@ -152,8 +152,9 @@
         {
 	  File f = filechooser.getFileSystemView().createFileObject(obj
 	                                                            .toString());
-	  if (filechooser.isTraversable(f))
-	    filechooser.setCurrentDirectory(f);
+	  if (filechooser.isTraversable(f) && 
+              filechooser.getFileSelectionMode() == JFileChooser.FILES_ONLY)
+            filechooser.setCurrentDirectory(f);
 	  else
 	    {
 	      filechooser.setSelectedFile(f);
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to