Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

printing a swing component

  Asked By: Abarrane    Date: Aug 12    Category: Java    Views: 679
  

how to use a swing component for printing its contents.

For example, a JTable. I just need to pring its content, and
nothing else in the UI.

which command to use ? A sample code will be gratefully received.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Archana Kamble     Answered On: Sep 05

You will have to call table.print() without parameter.

see the code below:


try {
boolean complete = table.print();
if (complete) {
/* show a success message */
...
} else {
/*show a message indicating that printing was cancelled */
...
}
} catch (PrinterException pe) {
/* Printing failed, report to the user */
...
}

 
Didn't find what you were looking for? Find more on printing a swing component Or get search suggestion and latest updates.




Tagged: