Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4784285

Focus of Main Application lost after closing awt.print.PrinterJob.printDialog()

XMLWordPrintable

    • b11
    • x86
    • windows_2000



      Name: jl125535 Date: 11/25/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Windows 2000 professional

      A DESCRIPTION OF THE PROBLEM :
      After closing print dialog (either clicking OK or Cancel),
      the main application loses the focus. Other application in
      the machine gains the focus, and hide the java application.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the code attached
      2. Closing the print dialog either clicking OK or cancel
      3. Note that the main application loses the focus. Other
      application in the machine gains the focus, and hide the
      java application.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The java application should still be the one on focus

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.print.*;
      import javax.swing.*;

      class Test2 {

      public static void main(String[] args) {
      JFrame myFrame = new JFrame("Test");
      myFrame.setSize(new Dimension(200,200));
      myFrame.setVisible(true);

      //Users supplied code
      PrinterJob prnJob = PrinterJob.getPrinterJob();
               if (prnJob.printDialog())
               { try
                  { prnJob.print();
                  }
                  catch (PrinterException exception)
                  {
                  }
               }

      }

      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      use requestfocus()
      (Review ID: 145492)
      ======================================================================

      Name: jl125535 Date: 11/25/2002


      When the Print dialog is dismissed using either OK or Cancel, the
      application JFrame drops to one window from the top in the windows
      application z-order.
      (Review ID: 145677)
      ======================================================================

            son Oleg Sukhodolsky (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: