JDK-6403372 : REGRESSION: Focus problems after cancelling JFileChooser with null parent
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-03-24
  • Updated: 2011-02-16
  • Resolved: 2006-03-28
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REGRESSION :
Create frame with one button on it.
Set button's ActionListener to open new FileChooser with null parent.
Run application.
Press the button, file chooser opens.
Close it.

REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

public class TestApp {
	public static void main(String[] args) {
		final JFrame frame = new JFrame();
		frame.setSize(100, 100);
		final JButton button = new JButton("Browse");
		button.setMnemonic('b');
		frame.getContentPane().add(button);
		button.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				JFileChooser fileChooser = new JFileChooser();
				fileChooser.showOpenDialog(null);
			}});
		frame.addWindowListener(new WindowListener(){
			public void windowActivated(WindowEvent e) {}
			public void windowClosed(WindowEvent e) {}
			public void windowClosing(WindowEvent e) {
				frame.dispose();
				System.exit(0);
			}
			public void windowDeactivated(WindowEvent e) {}
			public void windowDeiconified(WindowEvent e) {}
			public void windowIconified(WindowEvent e) {}
			public void windowOpened(WindowEvent e) {}
		});
		frame.show();
	}
}


RELEASE LAST WORKED:
5.0 Update 6

RELEASE TEST FAILS:
mustang-b72

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Focus returns to pressed button.
ACTUAL -
Button is not focused.
This occurred between builds 1.6 b58 and b59.  I also tested this on Windows XP using  JOptionPane.showMessageDialog(...) and JFrame(), but this seems to only happen as stated by the user when you are using the JFileChooser showOpenDialog(null) method with a null.

Comments
EVALUATION This problem was introduced by the fix to 4810575. But it appeared only in b59 since the fix to 6338269 unmasked the problem. Anyway is's fixed in the context of 6386592.
28-03-2006

EVALUATION Sounds like an AWT focus issue - and in fact, I think there may already be a duplicate.
24-03-2006