-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
x86
-
windows_95
Name: gsC80088 Date: 02/11/99
When drawing a rect using "drawRect" which should visualize the current
clip-area, the left and the top line are not drawn although
there should be enough space. I tried two different printers
(HP Deskjet 600 and NEC Pinwriter P60).
Example:
import java.awt.*;
import java.awt.print.*;
import java.awt.print.PageFormat;
import java.awt.geom.*;
import java.lang.*;
public class PrintTest {
public static void main(String[] args) {
PrinterJob job = PrinterJob.getPrinterJob();
job.setCopies(1); // this works fine, 2 is displayed in the printer dialog
PageFormat pfDefault;
if (job.printDialog()) {
pfDefault=job.pageDialog(job.defaultPage());
int cnCopies=job.getCopies(); // this will always return 2 although changed in the dialog
Book bk = new Book();
bk.append(new CClippedRect(),pfDefault);
job.setPageable(bk);
try {
job.print();
}
catch (Exception exc) {
System.out.println("Printer Exception");
}
}
}
}
class CClippedRect implements Printable {
public int print(Graphics g, PageFormat pf, int pageIndex)
throws PrinterException {
Graphics2D g2=(Graphics2D)g;
BasicStroke stroke=new BasicStroke(0.2f);
g2.setStroke(stroke);
g2.setColor(Color.black);
Rectangle r=new Rectangle();
g2.getClipBounds(r);
g2.drawRect(r.x+5,r.y+5,r.width-10,r.height-10); // only the right and bottom line will be printed...
return(PAGE_EXISTS);
}
}
(Review ID: 48109)
======================================================================
- duplicates
-
JDK-4197377 The page format dialog does not reflect the settings made to pageFormat object
-
- Closed
-