473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.
Mar 4 '08 #1
2 1415
JosAH
11,448 Expert 8TB
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,

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

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

Similar topics

1
by: Michael J Whitmore | last post by:
I am getting tired of losing hair over this. Here is a function that simply inserts one of three images into a document right before printing. It is called for every element that has a specific...
0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
1
by: DCraig | last post by:
I'm having problems printing to a line printer from both Crystal Reports and SQL Server reporting services using dotnet. When I try and print a report from an application with Crystal I get the...
5
by: C-Services Holland b.v. | last post by:
Hi all, I've run into a problem trying to print from vb.net (2002) in Windows 98. To test it I've setup a single form with a button and the following code: 'the form has a button called...
4
by: Sukh | last post by:
Hi, I am tring to change the paper size from default to custom paper size. In print preview its showing my custom size but when I print it print on default paper size. Can any one help me to...
2
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the...
0
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the...
0
by: gnewsgroup | last post by:
In my asp.net 2.0 web application. I create chart images on the fly by getting the data from the database. These chart images all have fixed width, but the height is dynamic depending on the...
5
by: NoOneCanHelpMe | last post by:
Hello everyone, could someone help me please, I want to print out the frequency of each vowel in the string and I think I will need to use the hash table I already have but im not sure how to do it...
6
by: babaidebnath | last post by:
Hello all, I am presently having a problem with printing in C#. The problem is my customer provided me a pre printed paper and I need to print value into some specific positions. But problem is C#...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.