--- old/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java 2016-08-26 13:30:16.488456700 +0530 +++ new/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java 2016-08-26 13:30:15.896381500 +0530 @@ -478,9 +478,14 @@ } DialogOwner dlgOwner = (DialogOwner)attributes.get(DialogOwner.class); - Frame ownerFrame = (dlgOwner != null) ? dlgOwner.getOwner() : null; + Window ownerFrame = (dlgOwner != null) ? dlgOwner.getOwner() : null; - WPrintDialog dialog = new WPrintDialog(ownerFrame, this); + WPrintDialog dialog; + if (ownerFrame instanceof Frame) { + dialog = new WPrintDialog((Frame)ownerFrame, this); + } else { + dialog = new WPrintDialog((Dialog)ownerFrame, this); + } dialog.setRetVal(false); dialog.setVisible(true); boolean prv = dialog.getRetVal(); @@ -498,8 +503,14 @@ title = rb.getString("dialog.printtofile"); } catch (MissingResourceException e) { } - FileDialog fileDialog = new FileDialog(ownerFrame, title, + FileDialog fileDialog; + if (ownerFrame instanceof Frame) { + fileDialog = new FileDialog((Frame)ownerFrame, title, FileDialog.SAVE); + } else { + fileDialog = new FileDialog((Dialog)ownerFrame, title, + FileDialog.SAVE); + } URI destURI = dest.getURI(); // Old code destURI.getPath() would return null for "file:out.prn" @@ -531,10 +542,17 @@ ((pFile != null) && (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) { - (new PrintToFileErrorDialog(ownerFrame, + if (ownerFrame instanceof Frame) { + (new PrintToFileErrorDialog((Frame)ownerFrame, + ServiceDialog.getMsg("dialog.owtitle"), + ServiceDialog.getMsg("dialog.writeerror")+" "+fullName, + ServiceDialog.getMsg("button.ok"))).setVisible(true); + } else { + (new PrintToFileErrorDialog((Dialog)ownerFrame, ServiceDialog.getMsg("dialog.owtitle"), ServiceDialog.getMsg("dialog.writeerror")+" "+fullName, ServiceDialog.getMsg("button.ok"))).setVisible(true); + } fileDialog.setVisible(true); fileName = fileDialog.getFile();