Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to print JTable with multi-line header?

 
Tim Gruentaler
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The title says it... I'm trying to print it with myJTable.print(JTable.PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat).
I tried inserting "\n" into the headerFormat string but it didn't work and i have no idea how to do it.

I have googled this problem but all the topics on forums i found remain unanswered.
Anybody knows how to solve this, especially using the core api?

Thanks,

Irmin
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try wrapping the label inside <html> and </html>, then use <br> for a line break. Swing components recognize a bit of HTML, and for labels that has so far been the easiest way to enter a line break.
 
Tim Gruentaler
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, Rob.

I tried the html but it prints out the tags together with the rest of the text...and again in one line. While googling i saw that people enter a new line like this
new MessageFormat("some text \n");
But it seems not to be working in Jtable's print method...

More suggestions would be great.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic