473,657 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem after Printing GUI.

2 New Member
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.getP rinterJob();
printJob.setPri ntable(this);

if (printJob.print Dialog())
try {
printJob.print( );
} catch(PrinterEx ception pe) {
System.out.prin tln("Error printing: " + pe);
}
}

public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterExceptio n {
// TODO Auto-generated method stub
if (pageIndex > 0) {
return(NO_SUCH_ PAGE);
}
else {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(7 3, 73);
g2d.scale(0.65, 0.8);

disableDoubleBu ffering(dia);
dia.paint(g2d);
enableDoubleBuf fering(dia);
return(PAGE_EXI STS);
}

}


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

Any help will be appreciated.
Mar 4 '08 #1
2 1431
JosAH
11,448 Recognized Expert MVP
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
coldblood22
2 New Member
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
7299
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 id in the document with the onbeforeprint window call. The chosen image will then be inserted into the document as a child element of ‘fig'. The problem is the images decide on their own whether or not to show up to the party. Random images...
0
2124
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 some problems I encountered while using them. Please note that, the Regional and Language setting on my machine is using "Metric" measurement system (where the default is "US"). In this case, the measurement unit is "milimeters" and not "inches".
1
9574
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 error message "the data area passed to a system call is too small", and nothing else. With SSRS when I try to print the report from the IDE I get the same error, I can load the report up to the report server and view it with IE, then print it from...
5
1963
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 Button1, a printdocument1, a printdialog1, a printpreviewdialog1 and the following code: Private Sub PrintDocument1_PrintPage(ByVal sender as System.Object,
4
2805
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 figure out this? I am using following code: Dim customPaperSize As New PaperSize("11x9", 1100, 900) pdMain.DefaultPageSettings.PaperSize = customPaperSize
2
2535
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 locations. But After printing first page it increase paper 3cm vertically/Height so on second
0
1123
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 locations. But After printing first page it increase paper 3cm vertically/Height so on second
0
1680
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 number of rows in the table returned from the database. These chart images are put into an HTML table through code-behind. They display nicely in either IE or FireFox. But, there is a problem printing them when the chart image is too big to fit...
5
1774
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 Thank you in advance import java.util.*; public class TextAnalyzer { public static void main(String args) { Scanner in = new Scanner(System.in);
6
10242
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# for its generic autofit to page nature dont let me doing this. Every time it is decreasing whole page's size and also altering my value position into some specific ratio. Can anyone tell me how can I come over that problem. This is my code
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.