Create Rectangular Colored Image from container or Script

Trying to create and Image from a container, or even from just Script. the idea is to create an image that will just have a background color, i will be getting the color from by DB. so if the user for example chooses the color red. i want to create an image with a rectangle(with red background, size 16x16) I’m using this later on in a JMenuItem to make an Icon for it. but can’t seem to find a way to create and image from scratch. Any suggestions?