Link to home
Start Free TrialLog in
Avatar of allie
allie

asked on

Printing swing components

I have a page that's displayed to the user with information from a database inquiry.  There's a print button on this page.  I need a way to print that will allow more than one page.  The current code looks something like this:

Graphics2D g2d = (Graphics2D)g;
g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
componentToBePrinted.paint(g2d);
return(PAGE_EXISTS);

where componentToBePrinted is set to the JFrame I use to display the database info.  The problem is that only one page is printed regardless of how many pages are needed to display all the text.  Is there any way around this?  Explanations or links to good examples would be greatly appreciated!

allie
ASKER CERTIFIED SOLUTION
Avatar of kylar
kylar

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 allie
allie

ASKER

Kylar -

You are the coolest!  That solved the problem perfectly with absolutely minimal changes to my code.  Exactly what I was looking for.  Thanks!!!

allie