JDK-4761744 : Win32 java.awt.print.PrinterJob.printDialog() blocks
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2002-10-11
  • Updated: 2004-02-27
  • Resolved: 2004-02-27
Related Reports
Duplicate :  
Relates :  
Description

Name: ssR10077			Date: 10/11/2002

###@###.###
If java.awt.print.PrinterJob.printDialog() is called on EDT, it is blocked
preventing dispatching PaintEvent and repainting of LightWeight components.
The following test demonstrates it. If the PaintEvent would be dispatched
the frame shall be red.

import java.awt.*;
import java.awt.print.*;

public class PrintTest extends Frame {
       public PrintTest() {
           setSize(500, 500);
           setVisible(true);

            EventQueue.invokeLater(
                new Runnable() {
                    public void run() {
                        PrinterJob job = PrinterJob.getPrinterJob();
                         job.printDialog();
                    }
               }
           );
     }

    public void paint(Graphics g) {
       super.paint(g);
       g.setColor(Color.RED);
       g.fillRect(0, 0, getWidth(), getHeight());
    }

    public static void main(String ars[]) {
       PrintTest test = new PrintTest();
    }
}

======================================================================

Comments
EVALUATION Name: ssR10077 Date: 10/11/2002 WPrinterJob.jobSetup calls native PrintDlgA. If it is called on EDT, it blocks event dispatching. ======================================================================
11-06-2004

WORK AROUND Name: ssR10077 Date: 10/11/2002 With Swing use javax.print instead of java.awt.print or call printDialog on a separate Thread. ======================================================================
11-06-2004