By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

Problem after Printing GUI.

P: 2
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();

if (printJob.printDialog())
try {
} 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) {
else {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(73, 73);



This is the code i am using to print the GUI.

Any help will be appreciated.
Mar 4 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 10K+
P: 11,448
Perform a little experiment: comment out all the code in that print() method
except for a dummy return statement and see what happens. If you still get
that error the cause must be found somewhere else. If the error is gone the
print() method caller(s) are most likely the guilty party.

kind regards,

Mar 4 '08 #2

P: 2
I tried commenting the parts of print() function.
The problem exists when the printJob.print(); is in action.
Mar 4 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.