• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing invicible JTable with Column removed - JTable.PrintMode.FIT_WIDTH problem

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it legal to post copyright code on a public forum?
 
Alexander Walker
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Alexander Walker
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Heres the code:

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic