[英]Java: Can i print a JFrame/JPanel as it looks on screen?
If i design a JFrame/JPanel
with labels, tables, textfields etc, is it possible to print it as it looks on screen? 如果我设计的JFrame/JPanel
具有标签,表格,文本字段等,是否可以按屏幕上的外观进行打印?
If so, what size parameters should i keep in mind? 如果是这样,我应该记住什么尺寸参数? Considering it's an A4 page, how should i go about sizing my JFrame/JPanel? 考虑到它是A4页面,我应该如何调整JFrame / JPanel的大小?
Thank you. 谢谢。 : ) :)
Have a look at the printing example at Exampledepot: The Quintessential Printing Program Using a Printing Service . 在Exampledepot上查看打印示例:使用打印服务的典型打印程序 。
Use this in conjunction with SwingUtilities.paintComponent
to draw the image you want to print. 将此与SwingUtilities.paintComponent
结合使用以绘制要打印的图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.