title: Generate thumbnail of website?
body: <p>For my application I need to dynamically create thumbnails of websites. So far I have this code from SO:</p>
  
  <pre><code>public class CreateWebsiteThumbnail {
  
      private static final int WIDTH = 128;
      private static final int HEIGHT = 128;
  
      private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
  
      public void capture(Component component) {
          component.setSize(image.getWidth(), image.getHeight());
  
          Graphics2D g = image.createGraphics();
          try {
                  component.paint(g);
          } finally {
                  g.dispose();
          }
      }
  
      private BufferedImage getScaledImage(int width, int height) {
          BufferedImage buffer = new BufferedImage(width, height,
                          BufferedImage.TYPE_INT_RGB);
          Graphics2D g = buffer.createGraphics();
          try {
                  g.drawImage(image, 0, 0, width, height, null);
          } finally {
                  g.dispose();
          }
          return buffer;
      }
  
      public void save(File png, int width, int height) throws IOException {
          ImageIO.write(getScaledImage(width, height), "png", png);
      }
  
      public static void main(String[] args) throws IOException {
  
          Shell shell = new Shell();
          Browser browser = new Browser(shell, SWT.EMBEDDED);
          browser.setUrl("http://www.google.com");
  
  
          CreateWebsiteThumbnail cap = new CreateWebsiteThumbnail();
          cap.capture(What her?);
          cap.save(new File("foo.png"), 64, 64);
      }
  
  
  }
  </code></pre>
  
  <p>But as you can see here, I don't know which part of the browser I should pass to my capture method. Any hints?</p>