Reputation: 79
There is a JFrame
with JPanel
DefaultTableModel
with JScrollPane
. How to save the entire JFrame
to an image file?
Upvotes: 3
Views: 5059
Reputation: 25950
ImageIO
class will help you. 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. For more information take a look at this post:
http://www.java-tips.org/java-se-tips/java.awt/how-to-capture-screenshot.html
Upvotes: 2