Index: javax/swing/plaf/basic/BasicFileChooserUI.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,v retrieving revision 1.9 diff -u -r1.9 BasicFileChooserUI.java --- javax/swing/plaf/basic/BasicFileChooserUI.java 6 Sep 2005 20:52:32 -0000 1.9 +++ javax/swing/plaf/basic/BasicFileChooserUI.java 6 Sep 2005 21:03:29 -0000 @@ -1,40 +1,39 @@ /* BasicFileChooserUI.java -- - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. - This file is part of GNU Classpath. - - GNU Classpath is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GNU Classpath is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. */ +This file is part of GNU Classpath. +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package javax.swing.plaf.basic; @@ -146,13 +148,13 @@ */ public void actionPerformed(ActionEvent e) { - Object obj = filelist.getSelectedValue(); + Object obj = new String(parentPath + entry.getText()); if (obj != null) { File f = filechooser.getFileSystemView().createFileObject( obj.toString()); if (filechooser.isTraversable(f) - && filechooser.getFileSelectionMode() == JFileChooser.FILES_ONLY) + && filechooser.isDirectorySelectionEnabled()) filechooser.setCurrentDirectory(f); else { @@ -391,7 +388,8 @@ } else { - File f = fsv.createFileObject(list.getSelectedValue().toString()); + String path = list.getSelectedValue().toString(); + File f = fsv.createFileObject(path); if (filechooser.isTraversable(f)) { setDirectorySelected(true); @@ -402,7 +400,9 @@ setDirectorySelected(false); setDirectory(null); } - lastSelected = list.getSelectedValue().toString(); + lastSelected = path; + parentPath = path.substring(0, path.lastIndexOf("/") + 1); + entry.setText(path.substring(path.lastIndexOf("/") + 1)); timer.restart(); } } @@ -953,6 +949,12 @@ /** DOCUMENT ME! */ JPanel closePanel; + /** Text box that displays file name */ + JTextField entry; + + /** Current parent path */ + String parentPath; + // -- end private -- private class ListLabelRenderer extends JLabel implements ListCellRenderer { @@ -1090,6 +1083,10 @@ installDefaults(fc); installComponents(fc); installListeners(fc); + + Object path = filechooser.getCurrentDirectory(); + if (path != null) + parentPath = path.toString().substring(path.toString().lastIndexOf("/")); } } @@ -1279,7 +1276,7 @@ JLabel fileNameLabel = new JLabel("File Name:"); JLabel fileTypesLabel = new JLabel("Files of Type:"); - JTextField entry = new JTextField(); + entry = new JTextField(); filters = new JComboBox(); filterEntries();