-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b01
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Keyboard focus is not transfered to JWindows with JFrame owners altough the JWindow is focusable.
This is working properly under 1.4.2_12 , 1.5.0_6, 1.5.0_7. broken only in 1.5.0_8
Maybe a side effect of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399303 ?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program. Partially cover the JWindow with some other process's window and make sure this other window has keyboard focus. Now, use the mouse to click and select the text in the JWindow's text field.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when the text field is clicked , the other window should be minimized, text field should gain keyboard focus
ACTUAL -
Text field does not gain keyboard focus . Other external window is not minimized
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class FocusTest {
public static final void main(String[] args){
JFrame mainFrame = new JFrame("Main frame");
mainFrame.getContentPane().add(new JLabel("Main frame label"));
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack();
JWindow sonWindow = new JWindow(mainFrame);
sonWindow.getContentPane().add(new JLabel("Child Window label"));
sonWindow.getContentPane().add(new JTextField("Child Window Field"));
sonWindow.pack();
sonWindow.show();
mainFrame.show();
System.out.println("Son window is focusable: "+sonWindow.isFocusable());
System.out.println("Son window focusable state: "+sonWindow.getFocusableWindowState());
//sonWindow.setFocusableWindowState(true); //uncommenting this line workaround the bug
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Calling sonWindow.setFocusableWindowState(true); after the window is shown fixes it. Note that the jwindow is focusable at this time!
This workaround is not good for our application since we don't create the JWindows they are created by a third party framework.
Release Regression From : 5.0u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Keyboard focus is not transfered to JWindows with JFrame owners altough the JWindow is focusable.
This is working properly under 1.4.2_12 , 1.5.0_6, 1.5.0_7. broken only in 1.5.0_8
Maybe a side effect of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399303 ?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program. Partially cover the JWindow with some other process's window and make sure this other window has keyboard focus. Now, use the mouse to click and select the text in the JWindow's text field.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when the text field is clicked , the other window should be minimized, text field should gain keyboard focus
ACTUAL -
Text field does not gain keyboard focus . Other external window is not minimized
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class FocusTest {
public static final void main(String[] args){
JFrame mainFrame = new JFrame("Main frame");
mainFrame.getContentPane().add(new JLabel("Main frame label"));
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack();
JWindow sonWindow = new JWindow(mainFrame);
sonWindow.getContentPane().add(new JLabel("Child Window label"));
sonWindow.getContentPane().add(new JTextField("Child Window Field"));
sonWindow.pack();
sonWindow.show();
mainFrame.show();
System.out.println("Son window is focusable: "+sonWindow.isFocusable());
System.out.println("Son window focusable state: "+sonWindow.getFocusableWindowState());
//sonWindow.setFocusableWindowState(true); //uncommenting this line workaround the bug
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Calling sonWindow.setFocusableWindowState(true); after the window is shown fixes it. Note that the jwindow is focusable at this time!
This workaround is not good for our application since we don't create the JWindows they are created by a third party framework.
Release Regression From : 5.0u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- relates to
-
JDK-6399303 Non-Focusble window steals focus from other applications.
- Resolved
-
JDK-6469440 Regression: Encounter NPE when trying to print a help topic provided by JavaHelp
- Closed
-
JDK-6253913 Reg. TextField in a Window having an iconified frame as parent behaves improperly
- Closed
-
JDK-6558271 Regression: No keyboard focus in a focusable Dialog
- Closed
-
JDK-6391763 REG: Window not gaining focus even after the parent dialog is made visible, WinXP
- Closed