rkcole.com
An example of using JAI to take a snapshot of the screen and stores it in a file. For a bit of added utility, there is an optional command-line parameter that causes the program to delay for a specified number of seconds prior to taking the snapshot. The delay would give you time to bring a window to the front or iconize your java command-window.