0

Here is my code what I did

 MessageFormat headerFormat = new MessageFormat("Name: "+name+""+"Job No:"+job+" "+" Total-Amount: "+total);
 MessageFormat footerFormat = new MessageFormat("Details Report of "+date);
 table.print(JTable.PrintMode.FIT_WIDTH,headerFormat, footerFormat);

This shows output as a line but I want to show the output message like as:

Name:Myname

Job No:12

Total-Amount:200

Please help me to out of this...thanks in advance

aldrin
  • 4,482
  • 1
  • 33
  • 50
Tusar Hasan
  • 143
  • 1
  • 2
  • 11
  • ^^ See [Kleopatra's Answer](http://stackoverflow.com/a/12105116/982149) in addition to the accepted one. – Fildor Mar 02 '17 at 11:41

1 Answers1

0

In general please don't use MessageFormat like this--if you append the Strings you do not use the advantages of a MessageFormat. However print just takes a MessageFormat for injecting the pageNumber.

Christian Ullenboom
  • 1,388
  • 3
  • 24
  • 20
  • Here is why OP is trying to do that: https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.html#print-javax.swing.JTable.PrintMode-java.text.MessageFormat-java.text.MessageFormat- – Fildor Mar 02 '17 at 12:08