FULL PRODUCT VERSION : JDK 6u31 ADDITIONAL OS VERSION INFORMATION : Microsoft Windows OS A DESCRIPTION OF THE PROBLEM : Java cross-platform Page Setup and Print dialogs do not always list all media sizes supported a printer. For example, if a printer supports both "11x17" and "Tabloid" media sizes according to its printing preferences in the system, the mentioned Java dialogs will show only "Tabloid" media size. Although these two media sizes are of the same size 11in x 17in, some users can be confused with absence of the expected "11x17" size on one of the two Java dialogs. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Verify that there is a printer which supports the media sizes "11x17", "Tabloid" in the system. 2. Set the printer found in the step #1 as a default printer in the system. 3. Compile and run the provided source code. 4. Try to find "11x17" in the contents of "Media Size" combo box on the displayed Page Setup dialog. REPRODUCIBILITY : The bug is reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.*; import java.awt.print.*; import javax.print.attribute.*; public class PrintDialogExample implements Printable { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { return NO_SUCH_PAGE; } Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); g.drawString("Test the print dialog!", 100, 100); return PAGE_EXISTS; } public static void main(String args[]) { HashPrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() != null) { PageFormat pf = job.pageDialog(aset); if (pf != null) { job.setPrintable(new PrintDialogExample(), pf); } else { job.setPrintable(new PrintDialogExample()); } if (job.printDialog(aset)) { try { job.print(aset); } catch (PrinterException pe) { pe.printStackTrace(); } } } } } ---------- END SOURCE ----------
|