I have no idea what you're asking. What are you trying to prevent from "leaving the applet"? What exactly does that even mean?
By the way, this is the completely wrong forum for this question. I'll move the thread for you.
--- Update ---
This thread has been cross posted here:
Although cross posting is allowed,
for everyone's benefit, please read:
Java Programming Forums Cross Posting Rules
The Problems With Cross Posting