jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes java swing crossFeedResolution < 1 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "java swing crossFeedResolution < 1 problem" Watch "java swing crossFeedResolution < 1 problem" New topic

java swing crossFeedResolution < 1 problem

Girish Vankayala

Joined: Dec 16, 2009
Posts: 3
My application has a print screen button. Off late a few clients have sent in a few error reports. This is an example stack trace:


I have not been able to duplicate the problem myself but a client told me that this happens often (does'nt happen everytime they click the "Print Screen" button), and when it fails it causes the application to freeze and they have to terminate the app using the "Task Manager".

Here is the action my "Print Screen" button is bound to:

Here is my implementation of the PrintUtilities class, with the print methods:

Rob Spoor

Joined: Oct 27, 2005
Posts: 20273

Please use code tags. I've added them for you this time, and look how much easier it is to read your code.

The stack trace tells you a lot of where the problem is coming from:This tells me that the problem is in the PrinterResolution constructor that is called. This constructor takes a crossFeedResolution that it uses in calling the super constructor. Now the bad news. This PrinterResolution instance is created by one of Sun's internal classes, sun.awt.windows.WPrinterJob. I don't have the source of that.

The rest of the stack trace informs me that the issue is not caused by your code but by the Java API instead. When the print dialog is shown (sun.awt.windows.WPrintDialogPeer._show) this is setting the resolution but it can't determine it, thereby passing -1 to the PrinterResolution constructor. I can't tell you how to solve this though. Perhaps it simply is a matter of incorrect printer drivers, or something else outside the world of Java.

How To Ask Questions How To Answer Questions
Girish Vankayala

Joined: Dec 16, 2009
Posts: 3
Thank You for your reply Rob. I will make sure I use the "code" tags next time. That was my first post

I heard today that there is more than one client with the same problem. I will ask one who had this problem yesterday to update their printer drivers and check if it fixes the problem. We usually tell the clients to update their Java when we have a problem like this but this client is on Java 1.6.0_17.

Thank You again for your reply.
I agree. Here's the link: http://aspose.com/file-tools
subject: java swing crossFeedResolution < 1 problem
jQuery in Action, 3rd edition