1

I have an applet running in a browser tab. When I switch to a different tab in the same browser, or ALT-TAB to another application entirely, the applet loses focus. When I return to the browser tab, the applet doesn't gain focus again. Is there a nice way to make this happen?

I assume it's a JavaScript change that's needed, not in the applet itself? Some onFocus handler perhaps? If it's relevant, our applet is created using an HTML <applet> tag.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589

1 Answers1

2

I believe java has the requestFocus() method. It's in the Component class, so your JPanel or whatever you are using may be able to use this.

For the javascript part, this is what a quick googling reveals: http://www.raditha.com/java/javascript.php. I hope it helps you!

11684
  • 7,356
  • 12
  • 48
  • 71