-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When a frame opens a modal dialog the focus shifts from the frame to the dialog. When the dialog is dismissed via the Dialog.dispose() method, the focus is suppose to shift back to the frame.
This is not happening with JDK 1.6.0_01. When the dialog is disposed, the frame that owned it is not getting focus.
Furthermore, under some circumstances other applications are getting the focus and covering up the frame. I have seen this on the secondary display (attached monitor as oppose to a laptop's screen), but not on the primary display. Other people have seen this on the primary display.
This problem started occurring with Java 1.6.0_01. It did not occur with Java 1.5.x.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the program given in the "source" section of this bug report. Make sure to have another application like Notepad.exe underneath the program's frame.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program's frame should stay on top when the dialog is dismissed. The program's frame should have focus.
ACTUAL -
The program's frame becomes obscured by another application's window. The program's frame does not have focus.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.*;
public class TestFocus
{
public static void main (String [] args)
{
try
{
final Frame frame = new Frame("Testing focus");
frame.setBounds(1200, 100, 400, 400);
frame.setVisible(true);
System.out.println("Frame has focus");
Thread.sleep(2000);
System.out.println("Disabling frame");
frame.setEnabled(false);
final Dialog dialog = new Dialog(frame, true);
Runnable task = new Runnable()
{
public void run ()
{
dialog.setBounds(1300, 200, 200, 200);
dialog.setVisible(true);
}
};
Thread thread = new Thread(task);
thread.start();
Thread.sleep(2000);
System.out.println("Re-enabling frame");
dialog.dispose();
frame.setEnabled(true);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The frame could call the resquestFocus() method to regain focus.
Also, this
Release Regression From : 5.0u12
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.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When a frame opens a modal dialog the focus shifts from the frame to the dialog. When the dialog is dismissed via the Dialog.dispose() method, the focus is suppose to shift back to the frame.
This is not happening with JDK 1.6.0_01. When the dialog is disposed, the frame that owned it is not getting focus.
Furthermore, under some circumstances other applications are getting the focus and covering up the frame. I have seen this on the secondary display (attached monitor as oppose to a laptop's screen), but not on the primary display. Other people have seen this on the primary display.
This problem started occurring with Java 1.6.0_01. It did not occur with Java 1.5.x.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the program given in the "source" section of this bug report. Make sure to have another application like Notepad.exe underneath the program's frame.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program's frame should stay on top when the dialog is dismissed. The program's frame should have focus.
ACTUAL -
The program's frame becomes obscured by another application's window. The program's frame does not have focus.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.*;
public class TestFocus
{
public static void main (String [] args)
{
try
{
final Frame frame = new Frame("Testing focus");
frame.setBounds(1200, 100, 400, 400);
frame.setVisible(true);
System.out.println("Frame has focus");
Thread.sleep(2000);
System.out.println("Disabling frame");
frame.setEnabled(false);
final Dialog dialog = new Dialog(frame, true);
Runnable task = new Runnable()
{
public void run ()
{
dialog.setBounds(1300, 200, 200, 200);
dialog.setVisible(true);
}
};
Thread thread = new Thread(task);
thread.start();
Thread.sleep(2000);
System.out.println("Re-enabling frame");
dialog.dispose();
frame.setEnabled(true);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The frame could call the resquestFocus() method to regain focus.
Also, this
Release Regression From : 5.0u12
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.