Exporting a JPanel to an image
问题 So I've been trying to export an image that I've drawn on a JPanel into an image. I've been using this method: BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); paint(g); try { ImageIO.write(image, "png", new File([location goes here]); } catch (IOException e) {} I get an image in my intended location but I get a compressed version of what my JPanel shows. The same happens if I try to export a BMP as well. Is