Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Java  & MySQL, Printing

Posted on 2004-11-15
5
Medium Priority
?
179 Views
Last Modified: 2006-11-17
Hi Experts,

I have a MySQL table which I have written a Java Application to add, navigate and (am currently working on) delete records. However, I would also like to add print function but am unsure how to do this.

Image I have a table wtih 4 fields:

User_First _Name
User_Second_Name
User_Branch
User_Department

I understand how to create an SQL query to find the relevant records requested. My problem is 2 fold but associated:

1. How do I ensure that the output when it is printed does not scroll off the end of my screen, for example, if My screen could display say 50 lines and the number of records returned was 75, how could I stop the page from scrolling off after line 51?
2. How do I create a report in Java, perhaps with a print preview option, with the same critieria as #1, i.e make sure the report stays on the page and has headers and footers etc.?

I'm guessing these should be possible but I cannot find anything on this on the net so would be grateful for any advice, links or whatever.

Thanks.
0
Comment
Question by:MushyPeeze
3 Comments
 
LVL 1

Accepted Solution

by:
FesterWim earned 500 total points
ID: 12591117
I suggest you use JFreeReport: http://www.jfree.org/jfreereport/

It is quite easy to create a report that way with headers and footers. You can also easily have a print preview. I already used this in a project of mine.

Another option is to convert your output to XML, then do an XSLT-FO transformation and use FOP to create a PDF. You can then use Acrobat Reader as print preview. But I would not recommend this option since you're not starting from XML anyway.
0
 

Expert Comment

by:mudri
ID: 12591203
why don't you control what will be displayed by limiting number of rows that mysql will return, i.e.:

SELECT * FROM workers LIMIT 50 OFFSET 0;
SELECT * FROM workers LIMIT 50 OFFSET 50;
 . . .

0
 
LVL 4

Expert Comment

by:gdrnec
ID: 12594040
Jasper is also a good alternative.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question