As you can see from its sourcecode, Graphics delegates this functionality to subclasses.
My implementation seems to use SunGraphics2d, which again delegates it to a PixelFillPipe, which there are many implementations of. The OGLRenderer delegates this functionality to the Graphics card if possible, using OpenGL. The X11Renderer uses native X calls, like this:
native void XFillRect(long pXSData, long xgc,
int x, int y, int w, int h);
public void fillRect(SunGraphics2D sg2d,
int x, int y, int width, int height)
{
SunToolkit.awtLock();
try {
long xgc = validate(sg2d);
XFillRect(sg2d.surfaceData.getNativeOps(), xgc,
x+sg2d.transX, y+sg2d.transY, width, height);
} finally {
SunToolkit.awtUnlock();
}
}
XRRenderer uses this code:
public synchronized void fillRect(SunGraphics2D sg2d,
int x, int y, int width, int height) {
SunToolkit.awtLock();
try {
validateSurface(sg2d);
XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData;
x += sg2d.transform.getTranslateX();
y += sg2d.transform.getTranslateY();
tileManager.addRect(x, y, width, height);
tileManager.fillMask(xrsd);
} finally {
SunToolkit.awtUnlock();
}
}
I showed you this code, because it is more than setting colors in an array. Your mileage will vary per platform and JRE.
As I don't know which renderer/fillpipe you use, I can only recommend to look at your very own code, it's not that hard.