My JTable is a table with some columns including a checkbox column. When the user clicks on the print button, the program will create an invisible copy of the visible table, then add a rowsorter to exclude all the rows with a checkbox that is set to false. then remove the checkbox column from the table. For the table to print I manually change the size of the table (else the content will not print).
That is how I set up the table, I hope it made sense.
But it is when I set the table to print with JTable.PrintMode.FIT_WIDTH thats not working as it should. The table is not printed across the whole page, like it still believes that the removed column is still there, resulting in that the rigthmost column will be cut, and not all data will be printed. I don't have this problem when printing JTable.PrintMode.NORMAL.
I hope my explanation made sense.
I have tried a long time to fix this but without result.
I'd be gratefull if someone could help me.
Here is the code.
edit: I have removed the code till someone who knows tells me it is okay (see the two posts below).
Is it legal to post copyright code on a public forum?
There are no new questions, but there may be new answers.
Joined: Jun 04, 2010
Darryl Burke wrote:Is it legal to post copyright code on a public forum?
If it is not, then I am sorry, and will remove the code, until someone gives me permission. Though I personally think I did do as the copyright stated, but it is up to the moderators to decide. I will remove the code until someone tells me it is okay. Just to let others know who read this later, it was code of Sun's JTable Printing example that was modified. I did keep the copyrighted text, so I never claimed it to be my own.
I'm sorry if I did something I should'nt have done.
Joined: Jun 04, 2010
I was able to solve the problem by myself, and will share it here. I have done a new program, and nothing is taken from Sun's example. The content of the method is a modified version of java2s.com's Set column width based on cell renderer, if I remember right. As far as I know this is not copyrighted code, atleast I coud'nt find anything about it. If anyone have a different opinion, then please tell me, and I will remove the code.