You could do something like the following. The code is based on theory as I didn't really have anything to try it against. Basically it just loops through all the JavaEditBoxes uisng index to determine which one has focus.
You could also use a loop and the exist method to determine exactly how many Editboxes there are so that you can adjust whatever you need to do accordingly and not accidentally overshoot your target destination.
Dim i As Integer ' control index variable
Dim bExists As Boolean ' control existence variable
Dim bFocus As Boolean ' control focus variable
i = 1
bExists = True
bFocus = False
' Loop while we have a valid index
Do While bExists = True
bExists = JavaEditBox("Index=" & CStr(i), tpAttachNoWait).Exists
' If the control exists and has focus exit the loop
If (bExists = True) And (JavaEditBox("Index=" & CStr(i), tpAttachNoWait).Focus = True) Then
bFocus = True