< prev index next >

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

Print this page

        

@@ -209,22 +209,21 @@
                                        flavor, attributes,
                                        (Dialog)owner);
         }
         Rectangle dlgBounds = dialog.getBounds();
 
-        // get union of all GC bounds
-        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
-        GraphicsDevice[] gs = ge.getScreenDevices();
-        for (int j=0; j<gs.length; j++) {
-            gcBounds =
-                gcBounds.union(gs[j].getDefaultConfiguration().getBounds());
-        }
-
         // if portion of dialog is not within the gc boundary
         if (!gcBounds.contains(dlgBounds)) {
-            // put in the center relative to parent frame/dialog
-            dialog.setLocationRelativeTo(owner);
+            // if dialog bounds exceed window bounds, set dialog x,y to bounds x,y
+            // so that dialog is entirely on-screen
+            if (dlgBounds.x + dlgBounds.width > gcBounds.x + gcBounds.width) {
+                x = gcBounds.x;
+            }
+            if (dlgBounds.y + dlgBounds.height > gcBounds.y + gcBounds.height) {
+                y = gcBounds.y;
+            }            
+            dialog.setBounds(x, y, gcBounds.width, gcBounds.height);
         }
         dialog.show();
 
         if (dialog.getStatus() == ServiceDialog.APPROVE) {
             PrintRequestAttributeSet newas = dialog.getAttributes();
< prev index next >