< prev index next >

src/java.desktop/share/classes/javax/print/ServiceUI.java

Print this page

        

@@ -33,15 +33,15 @@
 import java.awt.Rectangle;
 import java.awt.Window;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.AttributeSet;
+import javax.print.attribute.standard.DialogOwner;
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.Fidelity;
 
-import sun.print.DialogOwner;
 import sun.print.ServiceDialog;
 import sun.print.SunAlternateMedia;
 
 /**
  * This class is a collection of UI convenience methods which provide a

@@ -183,10 +183,11 @@
             defaultIndex = 0;
         }
 
         DialogOwner dlgOwner = (DialogOwner)attributes.get(DialogOwner.class);
         Window owner = (dlgOwner != null) ? dlgOwner.getOwner() : null;
+        boolean setOnTop = (dlgOwner != null) && (owner == null);
 
         Rectangle gcBounds = (gc == null) ?  GraphicsEnvironment.
             getLocalGraphicsEnvironment().getDefaultScreenDevice().
             getDefaultConfiguration().getBounds() : gc.getBounds();
 

@@ -206,10 +207,16 @@
                                        y,
                                        services, defaultIndex,
                                        flavor, attributes,
                                        (Dialog)owner);
         }
+        if (setOnTop) {
+            try {
+                dialog.setAlwaysOnTop(true);
+            } catch (SecurityException e) {
+            }
+        }
         Rectangle dlgBounds = dialog.getBounds();
 
         // if portion of dialog is not within the gc boundary
         if (!gcBounds.contains(dlgBounds)) {
             // check if dialog exceed window bounds at left or bottom
< prev index next >