Here's a quick and dirty tutorial on how to draw images in Java, then save them to the file system.

Drawing an image from scratch and saving to a png:

int width = 1024;
int height = 768;
//...