如何在标题中打印带有图像的jtable? [英] How to print a jtable with a image in the header?
本文介绍了如何在标题中打印带有图像的jtable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打印这样的东西
IMAGE
TITLE
JTABLE
我知道在messageFormat标题中打印带有标题的jtable,但我不知道如何添加图像
i know to print a jtable with the title in a messageFormat header but i dont know how to add the image
图像是徽标
推荐答案
您可以尝试显示的方法here 。在图片
drawImage()而不是 drawString()
>可打印。
You might try the approach shown here. Use drawImage()
instead of drawString()
in your Image
printable.
private static class Image implements Printable {…}
private static class Title implements Printable {…}
PrinterJob pj = PrinterJob.getPrinterJob();
Book book = new Book();
book.append(new Image(), pj.defaultPage());
book.append(new Title(), pj.defaultPage());
book.append(table.getPrintable(...), pj.defaultPage());
book.append(new EndPage(), pj.defaultPage());
pj.setPageable(book);
pj.print();
这篇关于如何在标题中打印带有图像的jtable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文