Microsoft KB Archive/261100

= FIX: Unexpected Exceptions Thrown During Printing =

Article ID: 261100

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Java Virtual Machine

-



This article was previously published under Q261100



SYMPTOMS
Errors may occur if your code displays a Print dialog box and the user selects Print to file, clicks OK, and then clicks Cancel.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug has been verified to occur in both the 3100 and 3200 series of the Microsoft virtual machine.

This problem was corrected in Windows 2000 Service Pack 1.



Steps to Reproduce Behavior
Compile and run the following code: import java.awt.*;

public class MSPrint extends java.awt.Frame { String string = &quot;Click to exit - > The Quick Brown Fox Jumps Over The Lazy Dog&quot;; public void init { setLayout(new GridLayout(1,1)); add(new Button(string)); }

public void print { PrintJob pj = Toolkit.getDefaultToolkit.getPrintJob(this,&quot;MSPrint&quot;,null); if(pj == null) { System.out.println(&quot;not printed&quot;); return; }   Graphics gc = pj.getGraphics; printAll(gc); gc.dispose; pj.end; }

public static void main(String[] args) { MSPrint arange = new MSPrint; arange.init; arange.pack; arange.show; arange.print; }

public boolean action(Event e, Object o) { System.exit(0); return true; } }

