public static void getSaveSnapShot(Component component, String fileName) throws Exception {
        BufferedImage img = getScreenShot(component);
        // write the captured image as a png
        ImageIO.write(img, "png", new File(fileName));
    }