< prev index next >
src/java.desktop/share/classes/sun/print/ServiceDialog.java
Print this page
@@ -182,12 +182,26 @@
(SunPageSelection)attributes.get(SunPageSelection.class);
if (pages != null) {
isAWT = true;
}
- if (attributes.get(DialogOnTop.class) != null) {
+ if (attributes.get(DialogOwner.class) != null) {
+ DialogOwner owner = (DialogOwner)attributes.get(DialogOwner.class);
+ /* When the ServiceDialog is constructed the caller of the
+ * constructor checks for this attribute and if it specifies a
+ * window then it will use that in the constructor instead of
+ * inferring one from keyboard focus.
+ * In this case the owner of the dialog is the same as that
+ * specified in the attribute and we do not need to set the
+ * on top property
+ */
+ if ((getOwner() == null) || (owner.getOwner() != getOwner())) {
+ try {
setAlwaysOnTop(true);
+ } catch (SecurityException e) {
+ }
+ }
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
tpTabs = new JTabbedPane();
@@ -276,12 +290,19 @@
this.psCurrent = ps;
this.docFlavor = flavor;
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
- if (attributes.get(DialogOnTop.class) != null) {
+ if (attributes.get(DialogOwner.class) != null) {
+ /* See comments in same block in initPrintDialog */
+ DialogOwner owner = (DialogOwner)attributes.get(DialogOwner.class);
+ if ((getOwner() == null) || (owner.getOwner() != getOwner())) {
+ try {
setAlwaysOnTop(true);
+ } catch (SecurityException e) {
+ }
+ }
}
Container c = getContentPane();
c.setLayout(new BorderLayout());
< prev index next >