Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

printing a jdbtable

  Asked By: Bastet    Date: Mar 05    Category: Java    Views: 722
  

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();
}
}
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on printing a jdbtable Or get search suggestion and latest updates.




Tagged: