Is there a way to take a screenshot using Java and save it to some sort of image? -


simple title states: can use java commands take screenshot , save it? or, need use os specific program take screenshot , grab off clipboard?

believe or not, can use java.awt.robot "create image containing pixels read screen." can write image file on disk.

i tried it, , whole thing ends like:

rectangle screenrect = new rectangle(toolkit.getdefaulttoolkit().getscreensize()); bufferedimage capture = new robot().createscreencapture(screenrect); imageio.write(capture, "bmp", new file(args[0])); 

note: capture primary monitor. see graphicsconfiguration multi-monitor support.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -