dcsimg

How do I automatically set the input focus in my applet to a specific component/text field when the browser loads the page that contains the applet?

Davanum Srinivas

The java.awt.Component class has a method named requestFocus(), you can use this to request focus on any component.

[FAQ manager note: You can use it, but it won't always work. For instance, if you have multiple applets on the page and each requests focus, only one of them will succeed.]