Storing java pop up on computer

I have a display popping up in java mode. What code would I use to save and store the java display on my computer. I know I can screen record but how how would I do it with processing. Thank you all and have a blessed day.

A screenshot can be made with save();

See reference