JDK-6530198 : 1.5.0_10 focus is not correctly returned to a JFrame
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0u10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2007-03-01
  • Updated: 2014-02-27
  • Resolved: 2007-06-12
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 Availability Release.

To download the current JDK release, click here.
Other
5.0u14 b01Fixed
Related Reports
Relates :  
Description
Focus does not get correctly returned to a JFrame after opening java.awt.PrinterJob.printDialog().  Focus incorrectly returns to the Browser window instead.
 
To reproduce:
1. Make an applet with a JButton. (Or load the applet in the attached test case)
2. Make this JButton open a JFrame. (Click on the JButton that says: "click here to open frame")
3. The JFrame should now be open.
4. Put a JButton on this JFrame, and make this JButton open a java.awt.PrinterJob.printDialog(). (Click on JButton labeled: "click here to print")
5. This will open a JDialog (In the test case it is titled: "Confirmation Needed - Print")
6. In the test case, Click Yes on the JDialog
7. From this point a Windows Print Manager window will open.
8.  The customer reports whether you click OK or Cancel, the focus will be on the browser window, not the JFrame you opened in step 2/3. 

In my testing, I notice that choosing OK on the Windows Print Manager, focus goes to the browser for a split second and then returns back to the JFrame.  If you Cancel the Windows Print Manager, focus will incorrectly return back to the Browser window.

You can also reproduce a very similar behaviour by 
Doubleclick the Java icon in the Windows system tray to display Java
Plugin version information. When you click OK to this window, the focus is
incorrectly returned to the browser window, and not to the JFrame opened in
step 2.

I have seen this problem with:
1.5.0_10 (build 1.5.0_10-b20061128)
1.5.0_10 (build 1.5.0_10-b03)
1.5.0_11 (build 1.5.0_11-b03)

The problem does not occur with 1.4.2_13 or 1.6.

Comments
WORK AROUND See Evaluation notes.
12-03-2007

EVALUATION Here is a workaround to the focus issue. I see two JFrame window popup when you click on the JButton in the Applet. Also I see couple of other issues with the test case, I've individualized them below: 1. Removing the init() method from test case, solves the two Frame popup issue and only one JFrame will popup. See attached workaround.tar testcase. 2. Focus not returning to the JFrame window after print dialog is closed: Grabbing focus after the print dialog closes, can be used as workaround to achieve this. See the modified sample in attachment for further details. 3. Before the Print Dialog is displayed a print confirm dialog pops up. Using the policy file from the workaround folder will not popup this dialog. Copy the .java.policy and save it into your policy directory , or home directory. Typically for a windows administrator user this is C:\Documents and Settings\<Administrator>
12-03-2007

EVALUATION Just piked it up from the queue. Will evaluate and update.
02-03-2007