i have a problem while i'm trying to print a jdbtable but the
problem is that i can't print all the content of the jdbtable it's
printing one paper only and i need all the content does anyone knows
where is my problem...Here is my code:
public int print(Graphics g, PageFormat pf, int pageIndex) {
if (pageIndex == 0) {
g.translate( (int) (pf.getImageableX()), (int) (pf.getImageableY()));
this.jdbTable1.paintAll(g);
return Printable.PAGE_EXISTS;
}
else
return Printable.NO_SUCH_PAGE;
}
void jButton2_actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JButton) {
PrinterJob printJob = PrinterJob.getPrinterJob();
PageFormat pf = printJob.defaultPage();
PageFormat landscape = printJob.defaultPage();
landscape.setOrientation(PageFormat.LANDSCAPE);
Book book = new Book();
Paper pr = new Paper();
int j = book.getNumberOfPages();
book.append(new Frameview(),landscape,j);
pr.setImageableArea(40, 40, 595.44, 769.68);
pr.setSize(595.44, 841.68);
pf.setPaper(pr);
printJob.setCopies(1);
printJob.defaultPage(pf);
printJob.setPrintable(this,pf);
if (printJob.printDialog()) {
try {
printJob.print();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}