Unfortunately, due to the way that the Container base class (which all swing components ultimately extend from) is implemented, no swing components can even be instantiated (let alone drawn) on a machine that is headless.
This is all because of the following block of static code in the Container class :
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
I can't really see any way around this. |