I have the following routine which seems to more or less work, but exhibits a few problems. I've gotten most of the code off a website.
Now I get things to print by calling the printComponent method and passing in my JPanel. No problem, the scaling and all works.
However, whether I scale things to fit the page, or remove that code, I get some strange behavior.
The JPanel has a few JLabels scattered about in a GridBagLayoutt, in three general columns.
However, I've noticed that *some* of the items in each column get truncated and have "..." tacked onto the end. But it doesn't do this to just the longest items, it also does it to shorter items, even if a longer one in the same column was NOT truncated in this manner.
So, what I'll have in one column is something like:
A long line that's been truncated... a short line, no problem a short line truncated... longer than above, not truncated
On screen, it's normal. Printed out, those weird truncations occur.
Why is this happening? There's plenty of room, and each of the lines that are getting truncated could easily be 1-1/2 times their length without the danger of bumping into the next column.
Is there any way to for me to force it to print the entire line in each case rather than cutting things off the way it's doing?
EDIT: Another problem I'd like to solve is that, the JPanel is gray with black text. I'm fine with that onscreen, but when it prints out, it prints a gray rectangle for the panel, with black text on it. Is there any way I can have this not print out the background as well (ie: treat background as white and only print the text that's on the JPanel?)
[ February 04, 2005: Message edited by: Joe Vahabzadeh ] [ February 04, 2005: Message edited by: Joe Vahabzadeh ]