Java JComponent to Image componentToImage(Component c)

Here you can find the source of componentToImage(Component c)

Description

component To Image

License

Open Source License

Declaration

public static BufferedImage componentToImage(Component c) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Component;

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage componentToImage(Component c) {
        BufferedImage image = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
        c.paint(image.getGraphics());//from   w w  w .  j a v  a 2 s.  com
        return image;
    }
}

Related

  1. buildImage(Component c)
  2. componentToImage(Component c)
  3. componentToImage(Component component, int resolution)
  4. doScreenshotToFile(final Component container, final Path filePath, final String imageType)
  5. ensureImageLoaded(Component owner, Image image)
  6. findConnectedComponents(int[][] image)