Click to See Complete Forum and Search --> : Which textbox has focus


daina
11-22-2005, 05:00 AM
Hai

I have a class say a() .That class is adding 3 jtextfields. I am calling this class in an japplet class. I want to check which textbox has focus .I used textbox1.hasFocus().But it is not working. Is there is any way to know whether a textbox has focus.

Regards
Daina

daina
11-24-2005, 01:59 AM
Hai
I have to use java code. The funcation hasFocus() is working in FocusGained event. But I want it in one funcation . Can anyone tell me what to do. I wrote code as

<code>
public int abc() {
int result = 0;
if(text1.hasFocus()){
result = 1;
}
else if(text2.hasFocus()){

result =2;
}
return result;
}
</code>