Link to home
Start Free TrialLog in
Avatar of MushyPeeze
MushyPeeze

asked on

Java & MySQL, Printing

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.
ASKER CERTIFIED SOLUTION
Avatar of FesterWim
FesterWim

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mudri
mudri

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;
 . . .

Jasper is also a good alternative.