-
Bug
-
Resolution: Fixed
-
P3
-
6u11, 8, 9
-
b117
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8273818 | openjdk8u322 | Prasanta Sadhukhan | P3 | Resolved | Fixed | b01 |
JDK-8272346 | 8u321 | Alexey Ivanov | P3 | Resolved | Fixed | b01 |
JDK-8274924 | 8u311 | Alexey Ivanov | P3 | Resolved | Fixed | b31 |
JDK-8272849 | 8u301 | Alexey Ivanov | P3 | Closed | Fixed | b34 |
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The PrinterJob cross-platform page setup dialog top margin entry is broken. If you enter a value in the top margin field and hit "OK", the value is not updated in the PageFormat instance return value, nor is it updated in the attribute set used to call the pageDialog method. Tabbing out of the top margin field before hitting OK does not fix the problem. Likewise, clicking on a different margin entry field before hitting OK also does not fix the problem. However, if you change the top margin and then tab or click into a different margin entry field and change the value in that field, then the change to the top margin takes effect (along with the change to the other margin). The problem only affects the top margin whereas the left, right, and bottom margins work fine.
The same top margin problem occurs in the "Page Setup" tab of the PrinterJob cross-platform print dialog. The problem can be illustrated by calling the cross-platform printDialog repeatedly, changing the margin values, and observing what happens to the top margin depending on whether other margin values are also changed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test code provided. It calls the pageDialog 5 times in a row, then the printDialog 5 times in a row, providing multiple opportunities to edit margin values and see what happens. Change the top margin with and without changing other margin values, then hit "OK" and observe how the top margin entries are affected.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be able to enter top margin values, hit OK, and have them take effect.
ACTUAL -
Changes to top margin values are ignored unless another margin field is also changed before hitting OK.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.MediaPrintableArea;
public class Test {
static public void main(String args[]) {
PrinterJob pj = PrinterJob.getPrinterJob();
try {
HashPrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
PageFormat pf;
for (int i=0; i<5; i++) {
pf = pj.pageDialog(aset);
double left = pf.getImageableX();
double top = pf.getImageableY();
System.out.println("pageDialog - left/top from pageFormat: " + left / 72 +
" " + top / 72);
System.out.println("pageDialog - left/top from attribute set: " +
getPrintableXFromASet(aset) + " " +
getPrintableYFromASet(aset));
}
for (int i=0; i<5; i++) {
boolean ok = pj.printDialog(aset);
System.out.println("printDialog - left/top from attribute set: " +
getPrintableXFromASet(aset) + " " +
getPrintableYFromASet(aset));
}
} catch (Exception e) { e.printStackTrace(); }
System.exit(0);
}
static double getPrintableXFromASet(PrintRequestAttributeSet aset) {
try { return ((MediaPrintableArea) aset.get(MediaPrintableArea.class)).getX(MediaPrintableArea.INCH);
} catch (Exception e) { return -1.0; }
}
static double getPrintableYFromASet(PrintRequestAttributeSet aset) {
try { return ((MediaPrintableArea) aset.get(MediaPrintableArea.class)).getY(MediaPrintableArea.INCH);
} catch (Exception e) { return -1.0; }
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround found
- backported by
-
JDK-8272346 Cross-platform pageDialog and printDialog top margin entry broken
- Resolved
-
JDK-8273818 Cross-platform pageDialog and printDialog top margin entry broken
- Resolved
-
JDK-8274924 Cross-platform pageDialog and printDialog top margin entry broken
- Resolved
-
JDK-8272849 Cross-platform pageDialog and printDialog top margin entry broken
- Closed
- duplicates
-
JDK-8271288 Need fix for JDK-6801613 backported to Java 8
- Closed
-
JDK-6509330 ServiceUI.printDialog ignores top margin
- Closed
-
JDK-6691639 PrinterJob cross-platform print dialog fails to pass top margin field data
- Closed
- relates to
-
JDK-8272344 [TEST_BUG] Automate PageDialogMarginTest.java test if possible
- Open
-
JDK-8272342 [TEST_BUG] java/awt/print/PrinterJob/PageDialogMarginTest.java catches all exceptions
- Resolved