I'm trying to create a method/function to determine if my app can create offscreen images using awt, and thanks to suggestions here in this forum I've been pointed in the direction of headless mode/state.
From what I've gathered: If an unsupported operation is attempted, a HeadlessException is thrown.
Therefore I hoped this would do the trick:
public boolean canDraw()
{
boolean rv = true;
try
{
Color c = new Color(100,100,100);
}
catch (HeadlessException he)
{
rv = false;
}
return rv;
}
But, alas, no HeadlessException is caught, and the app crashes.
Where am I thinking wrong?
Grateful for any help,
/J