my dog learned polymorphism
The moose likes Applets and the fly likes Applet focus problem, I think Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet focus problem, I think" Watch "Applet focus problem, I think" New topic

Applet focus problem, I think

Clayton Cramer
Ranch Hand

Joined: Aug 26, 2010
Posts: 41
I have an applet that requests data from the user in a JTextArea, with two buttons: OK and Cancel. It works fine--except if I enter text in the JTextArea, then move to some other part of the page containing the applet. From then on, if I try to move back to the JTextArea in the applet, everything is frozen. The buttons do not respond; I can't enter anything in the JTextArea; I can't close the browser. All I can do is use Task Manager to kill the Java Console. Then I can close the browser.

My guess is that having lost focus, the applet does not know what to do when I move the mouse back into the part of the web page that contains the applet. As a debugging thing, I added "implements WindowListener" to the applet's definition, and put in methods to log the various window events, in the hopes that this might give me some clues. But it does not appear that any of these methods are being invoked. (Perhaps there is something equivalent to WindowListener for an Applet that I should be using?)

I agree. Here's the link:
subject: Applet focus problem, I think
It's not a secret anymore!