United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7019963 : The goto parent directory button doesn???t operate in JFileChooser

Details
Type:
Bug
Submit Date:
2011-02-16
Status:
Closed
Updated Date:
2013-09-26
Project Name:
JDK
Resolved Date:
2011-08-03
Component:
client-libs
OS:
windows_xp,windows_7
Sub-Component:
javax.swing
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b125)
Java HotSpot(TM) Client VM (build 20.0-b06, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
The goto parent directory button doesn???t operate if the File name control has focus (in JFileChooser). This problem does not exist in JDK 6.0_20.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test that opens JFileChooser dialog and try to press the button.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JFileChooser should show files in the parent directory.
ACTUAL -
Nothing happens.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package tests.tests4;

import javax.swing.JFileChooser;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class choose2 {
	public static void main(String[] args) {
		try {
			// Set Windows Look&Feel
			UIManager.setLookAndFeel(
				UIManager.getSystemLookAndFeelClassName());
		} catch (UnsupportedLookAndFeelException e) {
		} catch (ClassNotFoundException e) {
		} catch (InstantiationException e) {
		} catch (IllegalAccessException e) {
		};
		JFileChooser chooser1= new JFileChooser();
		chooser1.showSaveDialog(null);
	}
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I don't know.

                                    

Comments
EVALUATION

It is reproducible on the latest JDK7 but not reproducible on JDK6u28,
accepted
                                     
2011-06-09
Verified!
                                     
2013-05-21
EVALUATION

The problem appeared after CR 6589634 was fixed. Now buttons in toolbar don't get focus when the left mouse button is pressed (button are configured with setRequestFocusEnabled(false)). At the same time the BasicFileChooserUI.ChangeToParentDirectoryAction#actionPerformed method contains the following strange code:

            Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
            if (focusOwner == null || !(focusOwner instanceof javax.swing.text.JTextComponent)) {
                getFileChooser().changeToParentDirectory();
            }

I believe we should remove focusOwner checking at all. BTW this focusOwner checking came with the following commit:

D 1.48 03/04/29 12:59:44 sky 65 59	00376/00278/00906
MRs:
COMMENTS:
Merged changes between child workspace "/net/jano/export/disk09/swing/SCCS_DIRECTORIES/synth-tiger" and
 parent workspace "/export/disk09/swing/SCCS_DIRECTORIES/swing-tiger".

The /export/disk09/swing/SCCS_DIRECTORIES/swing-tiger workspace doesn't exist now and we can't determine the reason of the focusOwner checking.
                                     
2011-06-14



Hardware and Software, Engineered to Work Together