< prev index next >
src/java.desktop/share/classes/javax/print/ServiceUI.java
Print this page
*** 209,230 ****
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);
}
dialog.show();
if (dialog.getStatus() == ServiceDialog.APPROVE) {
PrintRequestAttributeSet newas = dialog.getAttributes();
--- 209,244 ----
flavor, attributes,
(Dialog)owner);
}
Rectangle dlgBounds = dialog.getBounds();
// if portion of dialog is not within the gc boundary
if (!gcBounds.contains(dlgBounds)) {
!
! int dlgWidth = 0;
! int dlgHeight = 0;
!
! // if dialog bounds exceed window bounds, check if
! // positioning the dialog by moving it (bounds.x + bounds.width) - dlgBound.width
! // will result in moving it beyond the window bounds, then
! // position it at window top-left
! // so that dialog is entirely on-screen
! if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) {
! x = (gcBounds.x + gcBounds.width) - dlgBounds.width;
! dlgWidth = dlgBounds.width;;
! } else {
! x = gcBounds.x;
! dlgWidth = gcBounds.width;
! }
! if ((gcBounds.y + gcBounds.height - dlgBounds.height) > gcBounds.y) {
! y = (gcBounds.y + gcBounds.height) - dlgBounds.height;
! dlgHeight = dlgBounds.height;
! } else {
! y = gcBounds.y;
! dlgHeight = gcBounds.height;
! }
! dialog.setBounds(x, y, dlgWidth, dlgHeight);
}
dialog.show();
if (dialog.getStatus() == ServiceDialog.APPROVE) {
PrintRequestAttributeSet newas = dialog.getAttributes();
< prev index next >