Skip to main content

Capture webBrowser image, to produce thumbs

No replies

I am having problems getting the Image from the webBrowser component. I use the following code, and all I get is a transparent image.

public void documentCompleted(BrowserEvent event){
try {

// image = new Robot().createScreenCapture(new Rectangle(browserGUI.getX(),browserGUI.getY(),
//browserGUI.getWidth() ,browserGUI.getHeight()));
image = Tab.this.browser.getComponent().createImage(200,200);
if (image == null)
System.out.println("Not Creating screen capture");
image = image.getScaledInstance(200,200,image.SCALE_FAST);

JOptionPane.showMessageDialog(null,"icon","A plain message",JOptionPane.PLAIN_MESSAGE, new
} catch (AWTException e) {

But if I use the robot to capture the whole Frame instead I also get the webBrowser Area.

My problem is that I only want to capture the actuall HTML page and not the GUI aswell.
Does anyone have a suggestion on how to solve this problem, all help is much appreciated !