JDK-7019963 : The goto parent directory button doesn’t operate in JFileChooser
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp,windows_7
  • CPU: x86
  • Submitted: 2011-02-16
  • Updated: 2013-09-26
  • Resolved: 2011-08-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u2Resolved 8 b01Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
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
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

EVALUATION It is reproducible on the latest JDK7 but not reproducible on JDK6u28, accepted
2011-06-09