File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to print my table (send to printer)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to print my table (send to printer)?" Watch "How to print my table (send to printer)?" New topic
Author

How to print my table (send to printer)?

Chris Ben
Ranch Hand

Joined: Jan 15, 2001
Posts: 135
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

Joined: Nov 03, 2000
Posts: 331
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

Joined: Jan 15, 2001
Posts: 135
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

Joined: Sep 08, 2001
Posts: 5
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

Joined: Jan 15, 2001
Posts: 135
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
 
subject: How to print my table (send to printer)?
 
Similar Threads
how to make a printer friendly page?
how to send a text file to the printer
Need to get IP Address
how to print in java !!!
Printing to a Network Printer