How do I prevent people from hacking my applet?
Manipulating an applet is as easy as entering
javascript:document.getElementsByTagName("applet")[0].publicMe开发者_JAVA技巧thod();
into the address bar. How can I protect my applet from such manipulation?
It's not possible to implement security on the client side. You can make things more difficult by obfuscating your code, but obfuscation will only stop casual users from tampering. A determined and knowledgable user will be able to reverse engineer the applet even if it is obfuscated. No matter what you do, there will always be someone smart enough to figure out a way around it.
If security is important, do it on the server.
Only public applet methods can be accessed. So the solution to your problem is making the method private/protected.
Make the methods private. As for init(), start(), mousePressed(), keyPressed(), etc, just have those methods call upon the private ones
精彩评论