How to print a JTable header in two lines?

Posted by Eruls on Stack Overflow See other posts from Stack Overflow or by Eruls
Published on 2009-03-14T09:09:01Z Indexed on 2010/03/17 2:01 UTC
Read the original article Hit count: 299

Filed under:

Program is to print a JTabel and used function is

JTabel jt=new JTable();
MessageFormat headerFormat= new MessageFormat("My World Tomorrow");
MessageFormat footerFormat = new  MessageFormat("Page {0}");

jt.Print(JTabel.Format,headerFormat,footerFormat);

Query is: How to print the header in two lines that is

My World 
Tomorrow

Tired following solutions:

new MessageFormat("My world \n Tomorrow");
new MessageFormat("My world \r\n Tomorrow");
new MessageFormat("My world" System.getProperty("line.separator")+"Tomorrow"

);

Nothing works.

© Stack Overflow or respective owner

Related posts about printing