[英]saving JFrame as image file (.JPG, .PNG, .BMP etc)
There is a JFrame
with JPanel
DefaultTableModel
with JScrollPane
. 有一个带有
JScrollPane
JPanel
DefaultTableModel
的JFrame
。 How to save the entire JFrame
to an image file? 如何将整个
JFrame
保存到图像文件?
ImageIO
class will help you. ImageIO
类将帮助您。 The signature of the method you need is: 您需要的方法的签名是:
public static boolean write(RenderedImage im, String formatName, File output)
Determine image extension (.jpg, .png, .bmp etc) via formatName
parameter. 通过
formatName
参数确定图像扩展名(.jpg,.png,.bmp等) 。 For more information take a look at this post: 有关更多信息,请查看此帖子:
http://www.java-tips.org/java-se-tips/java.awt/how-to-capture-screenshot.html http://www.java-tips.org/java-se-tips/java.awt/how-to-capture-screenshot.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.