} catch (PrinterException e1) {
e1.printStackTrace();
}
}
if (spp != null){
PrinterJob job = PrinterJob.getPrinterJob();
job.setCopies(1);
String title = spp.getTitle().getText();
job.setJobName("Spielplan");
//noch anpassen uhrzeit, datum
/* // set the Printable to the PrinterJob
* resulst in some sort of screen shot
job.setPrintable(new Printable() {
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
if (pageIndex == 0) {
spp.print(graphics);
return Printable.PAGE_EXISTS;
}
return Printable.NO_SUCH_PAGE;
}
});*/
DruckSpielPanel dsp = new DruckSpielPanel();
dsp.setSps(spp);
dsp.setTitle(title);
dsp.setGetPrintInfo(true);
try {
job.setPrintable(dsp);
job.print();
// job.setPrintable(dsp);
dsp.setGetPrintInfo(false);
// show the dialog
if (job.printDialog()) {
job.print();
}
} catch (HeadlessException e1) {
e1.printStackTrace();
} catch (PrinterException e1) {
e1.printStackTrace();