如何在java MessageFormat()中添加新行

如何在java MessageFormat()中添加新行,java,swing,jframe,jtable,Java,Swing,Jframe,Jtable,这是我的代码我做了什么 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,

这是我的代码我做了什么

 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);
这将输出显示为一行,但我想将输出消息显示为:

姓名:我的名字

工作编号:12

总数:200


请帮我解决这个问题…提前谢谢

一般来说,请不要像这样使用
MessageFormat
——如果附加字符串,就不会使用
MessageFormat
的优点。但是,
print
只需要一个
MessageFormat
来注入页码。

^^除了可接受的页码之外,请参见。以下是OP尝试这样做的原因: