Application screen shot Write the minimal code you need to take a screenshot of your application window. I am not asking for a function or program; just only a code segment.

It has obviously to be a GUI application; console applications not allowed.

Input:

None.

Output:

The valid outputs are:


Clipboard. Then post a screenshot of the Paste contents on a drawing program.
A file. Upload it somewhere and post a link to it here.
Inside any other window different from the window that was shoot. Post screenshot of the new window here.


As it is code-golf minimum number of characters wins!
Java 8, 82 80 77 bytes

Class that extends Frame:

ImageIO.write(new Robot().createScreenCapture(bounds()),"png",new File("a"));


Regular Class 98 Bytes:

ImageIO.write(new Robot().createScreenCapture(Frame.getFrames()[0].bounds()),"png",new File("a"));


Uses deprecated bounds() method.