screenshot - Screen shot current active window in java -


currently developing project , requirement screenshot current active window on screen (assuming 1 monitor) , save image.

i have worked @ following code screenshots entire screen:

int x = 0,y = 0; color suit = new robot().getpixelcolor(x, y); rectangle fs = new rectangle(toolkit.getdefaulttoolkit().getscreensize()); bufferedimage rank = new robot().createscreencapture(fs); imageio.write(rank, "bmp", new file("hi.bmp")); 

and of understanding size of current active window 1 must use method such:

public static long gethwnd(frame f) {     return f.getpeer() != null ? ((wcomponentpeer) f.getpeer()).gethwnd() : 0; } 

however having trouble implementing method code, , have no previous experience working frames or rectangles.

could pointed in right direction in terms of go next! thanks.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -