Window freezes when pressed CTRL + P



In my application, When I Select File -> Print option the following
code executes fine, Where as I pressed CTRL + P from Keyboard my system
is hanging at this statement PrintService service =
ServiceUI.printDialog(null, 200, 200,printService, defaultService,
flavor, pras);

The following is the code, I used in my application. Please Help me
regaurding this.

PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG;
PrintService printService[] = PrintServiceLookup
.lookupPrintServices(flavor, pras);
PrintService defaultService = PrintServiceLookup
.lookupDefaultPrintService();
PrintService service = ServiceUI.printDialog(null, 200, 200,
printService, defaultService, flavor, pras);
if (service != null) {
new PrintTask(service, pras).start();
}

.



Relevant Pages