< prev index next >
src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java
Print this page
@@ -476,13 +476,18 @@
if (attributes == null) {
return false;
}
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();
dialog.dispose();
@@ -496,12 +501,18 @@
ResourceBundle rb = ResourceBundle.getBundle(strBundle);
try {
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"
// so we use getSchemeSpecificPart instead.
String pathName = (destURI != null) ?
@@ -529,14 +540,21 @@
while ((f.exists() &&
(!f.isFile() || !f.canWrite())) ||
((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();
if (fileName == null) {
fileDialog.dispose();
< prev index next >