sandeep1984
asked on
Printing a JTable in JAVA
I want to print a JTable which extends DefaultDableModel.
I am using JDK 1.6
The print dialog should show custom options like choosing landscape/portrair modes etc.
Thanks
I am using JDK 1.6
The print dialog should show custom options like choosing landscape/portrair modes etc.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i think the point must be splitted.
public boolean print() throws PrinterException
A convenience method that displays a printing dialog, and then prints this JTable in mode PrintMode.FIT_WIDTH, with no header or footer text. A modal progress dialog, with an abort option, will be shown for the duration of printing.
Returns:
true, unless printing is cancelled by the user
Throws:
PrinterException - if an error in the print system causes the job to be aborted
Since:
1.5
See Also:
print(JTable.PrintMode, MessageFormat, MessageFormat, boolean, PrintRequestAttributeSet, boolean),
getPrintable(javax.swing.J
So, this is how I print the tables in my app (Jave 1.5 or higher required):
myTable.print();
(I link it with the pressing of Ctrl+P in my table)