How to print multiple header lines with MessageFormat using a JTable

Viewed 11950

I have a table called table and its filled with data, I also have a MessageFormat header I want to use as a header to print the JTable this is the MessageFormat:

MessageFormat header = new  MessageFormat("Product: "
                    + task.getProductName() + "  Job: "
                    + task.getJobNumber() + "  Task: " + task.getTaskID()
                    );

I want to print 3 lines in the header, one for Product, Job and Task

the way I print this table is like so:

table.print(JTable.PrintMode.FIT_WIDTH, header, null);

I can't seem to figure out how to print the header in 3 seperate lines, I tried using the \n to make a new line but that doesn't seem to work.

5 Answers
Related