We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Which control have focus?

pengch
pengch asked
on
Medium Priority
181 Views
Last Modified: 2010-04-16
How can I identify the control that have focus in an Applet? Im using Visual J++ 1.1 (JDK 1.0).
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
I have several textfield in an applet. I need to identify which textfield having focus to emulate tab and limite the maximum caracter per field. But using method gotFocus of Applet, when a textfield adquire focus the method does not called (using Internet Explorer).

Commented:
How about lostFocus? Does that work in Internet Explorer.

Another hack of a sort would be to capture keyEvents, whichever TextField the last KeyEvent was in, save that and treat it as the one with Focus. There are obvious limitations of course. I don't know of anything else you could do though.

Generally this is difficult to do in JDK1.0.2, that's why the capability was added inherently in JDK1.1 and above.

Author

Commented:
Ok, I will use keydown eventĀ“s evt.target to identify the control. Thanks!!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.