FIX: Unexpected Exceptions Thrown During Printing (261100)



The information in this article applies to:

  • Microsoft 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.

MORE INFORMATION

Steps to Reproduce Behavior

Compile and run the following code:
import java.awt.*;

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

  public void print() {
    PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(this,"MSPrint",null);
    if(pj == null) { 
      System.out.println("not printed");
      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; 
  }
}
				

REFERENCES

For additional information about the latest service pack for Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:

260910 How to Obtain the Latest Windows 2000 Service Pack

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbfix kbJavaVM33xxfix kbWin2000sp1Fix KB261100