I have a JTable with a resized font (Arial, Font.PLAIN, 18pt) that I'm printing withJTable.print(). However, the JTable contents are truncated to about seven characters followed by an ellipsis ('...'). Any idea why this happens, and how to fix it? I need to resize my columns somehow, but I can't find a good way to do it that ensures that everything is displayed properly. It's further complicated by the fact that I'm printing without ever displaying the table, which means that at some point I have to set the size, or the JTable will print nothing but an empty box.

An SSCCE, for all the good it may do:
Java Code:
import java.awt.Font;
import java.awt.print.PrinterException;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

 * @author Brandon Sanderson
public class TableSSCCE {

    public static void main(String[] args) throws PrinterException{
        String[][] values = {{"1111111111", "3333333333"}, {"2222222222","4444444444"}};
        JTable table = new JTable(new DefaultTableModel (values, new String[]{"A","B"}));
        table.setFont (new Font("Arial", Font.PLAIN, 18));
        table.setSize (table.getPreferredSize ());//otherwise you get an empty box because there is no size
        table.print ();
Does pretty much what I'm seeing with my bigger program. (Checked with Microsoft XPS Document Writer on Win7, and I get a table with 4 truncated cells, which is what I expected)

A few notes about the larger program, just in case they affect this:
  • I use a custom model
  • The table is never displayed. (Same in the SSCCE)
  • The grid and border on the table are not displayed

They probably don't matter, but I'm not entirely sure at this point...

Thanks in advance for any help/suggestions!