<Swing Dev> May Component.isFocusOwner() be called by non-edt threads?

Christopher Deckers chrriis at gmail.com
Tue Nov 1 12:56:43 UTC 2011


Pavel,

> Of course all Swing methods (if javadoc doesn't say the opposite) must be
> called from EDT thread.

Which makes me remember that I recently received a bug report from
someone using the Java Access Bridge (JAB).

The bug is that JAB calls "Component.isFocusOwner()" outside of the
EDT but my component enforces correct threading calls. Because the
Javadoc does not say that it can be called from outside the EDT, I
throw an exception on that call (or rather, in
"Component.hasFocus()").
I don't know much about JAB, but the user seemed to imply he did not
create the JAB thread so I assume JAB did it.

My question: is it allow to call "Component.isFocusOwner()" or
"Component.hasFocus()" outside the EDT? If it is the case, shouldn't
the Javadoc say so?

Cheers,
-Christopher



More information about the swing-dev mailing list