|
Problem after Printing GUI.
Well in my Application i am using the java Printable interface to print the GUI.
The printing is done fine but once done with the printing my program breaks off with the database file without. Well i haven't made any calls to close the database after printing. But after printing, none of the modules recognize the database file. I manually tried to close and open the database after printing but still it is not able to access the tables.
I am using SQLite, and the exception i am getting is ' no such table found '.
I tried to access the database file with another program with my application running and it was running fine.
public void print() {
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);
if (printJob.printDialog())
try {
printJob.print();
} catch(PrinterException pe) {
System.out.println("Error printing: " + pe);
}
}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
// TODO Auto-generated method stub
if (pageIndex > 0) {
return(NO_SUCH_PAGE);
}
else {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(73, 73);
g2d.scale(0.65,0.8);
disableDoubleBuffering(dia);
dia.paint(g2d);
enableDoubleBuffering(dia);
return(PAGE_EXISTS);
}
}
This is the code i am using to print the GUI.
Any help will be appreciated.
|