I implementing a EventQueue and get notified when AWTEvents are send. I wait till instances of FocusEvent are send to the dispatchEvent methode.
The FocusEvent by itself does not have a methode to ask if the focus of the component is gained or lost. The methode paramString returns a String in which the information is placed, but i dont want to hack or pars the String. A contains call can give me the answer, but the returnes String is no constant, so it could change in the future.
The paramString methode of FocusEvent is like:
switch(id) {
case FOCUS_GAINED:
typeStr = "FOCUS_GAINED";
break;
case FOCUS_LOST:
typeStr = "FOCUS_LOST";
break;
default:
typeStr = "unknown type";
}
return typeStr + (temporary ? ",temporary" : ",permanent") +
",opposite=" + getOppositeComponent();
Do you know another solution for this issue.