File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to print my table (send to printer)?

 
Chris Ben
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a table in a scroll pane and would like to print out the contents by adding a 'print' feature in the menu bar. Can anyone tell me which class in java api will help me do the printing by the default printer?
Thanks
Chris
 
john mattucci
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go to : http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html
its a good place to start, but the example only works if all fields in the table are populated so u will need to play with the code
------------------
 
Chris Ben
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,
Thank you so much. Your information save me a lot of time and I only need to add two lines to make my case work.
Have a nice day
Chris
 
Shaz Ali
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Ben:
Hi John,
Thank you so much. Your information save me a lot of time and I only need to add two lines to make my case work.
Have a nice day
Chris

Hi
Chris can u pls write those lines for me...
because its working fine only for JTable,but if i m printing whole JPanel its giving error printing........
 
Chris Ben
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for responding so late. What I need to do is to print the table only, though it is in the scroll panel, I do not care about the part other than the contents of the table.
Check report.java in that website, I almost directly copy its codes for printing with my own TableModel written before.
good luck
Chris
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic