D
söö..
danke für den Tipp..
hatte noch etwas anderes zu tun.
Jetzt druckt sich das Bild zwar so schonmal ganz gut, aaaaalllllerdings sind meine gestrickelten Linien irgendwie immernoch schwarz.
Der Vollständigkeit halber erstmal der richtige Code für das Drucken selbst..
/**
* print document
* @param g A Graphics Device to print on
* @param pageFormat a page format descriptor
* @param pageIndex the pagenumber that is to be printed
* @return the Result of the print process
*
*/
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
/* print into buffered image */
int maxX = 0;
for (int i = 0; i < this.family.size(); i++) {
if (maxX < ((Person)this.family.get(i)).getPosX())
maxX = ((Person)this.family.get(i)).getPosX();
}
BufferedImage bImg = new BufferedImage(maxX + 100, this.screen.getHeight(), BufferedImage.TYPE_INT_ARGB);
this.redraw(bImg.getGraphics());
Graphics2D g2 = (Graphics2D) g;
g2.translate(pageFormat.getImageableX(),pageFormat.getImageableY());
g2.scale(pageFormat.getImageableWidth() / (maxX + 100),
pageFormat.getImageableWidth() / (maxX + 100)
);
int result = NO_SUCH_PAGE;
if (pageIndex < 1) {
// this.redraw(g2);
g2.drawImage(bImg, new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR),0, 0);
result = PAGE_EXISTS;
}
return result;
}
Meine gestrichelten Linien haben das Problem. dass sie über anderen, durchgezogenen Linien liegen können.
Deshalb habe ich ein GradientPaint gemacht.
g.setPaint(new GradientPaint( 0.0f, 0.0f, g.getColor(),
2.0f, 2.0f, g.getBackground(), true
));
Das sieht auch toll aus, ist aber eben auf dem Druckbild nicht zu erkennen.. Warum und iwe kann ich's anders machen?