Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Printing and Web start  RSS feed

 
Payam Fard
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a standalone Swing application, and I am using Java print APIs to print a JTree. When I am running the program from an executable jar file, print works fine. But, if I use webstart to run the application, for some reason some of the nodes' labels in the tree get truncated. Even though this seems to be a width issue, but some of the longer node labels are getting printed fine, but some of the shorter ones get truncated.
Any reason as to why this might happen, and any solutions for the fix?
Thanks,
Payam.
 
Payam Fard
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have posted the following questions on multiple user groups and web sites. But I have not received any responses yet. I was hoping the Authors of the Manning Swing book could help me.
I really appreciate any help.
Thanks,
Payam.
 
Matt Robinson
author
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess (emphasis on guess is that your the fontwidth is causing the problem. Try modifying your tree cell renderer to calculate the preferred width of each cell differently (not based on current font, which is default JLabel behavior)
 
Payam Fard
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying to my message. I do not think font width is the problem, because some lines which are longer are getting printed, but some shorter lines are getting truncated.
If all the lines were getting truncated from the same exact place, then font width could be a good candidate.
Any other suggestions?
Thanks,
Payam.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!