Problem: suddenly java applications such as Eclipse, NetBeans lost the text cursor focus (e.g. when performing auto complete, search, etc). A temporary fix was to switch alt-tab between the windows and then the focus would be regained.
Solution: In my case it seem to have been caused by SCIM. To fix it System/Administration/Language Support then uncheck the "Enable support to enter complex characters".
Keywords: ubuntu hardy heron java lost focus netbeans eclipse switch problem compiz SCIM