Is any way to convert a java applet code to JavaScript?
Not really, no. They're different languages with different libraries.
If you want to develop for the client-side Web with Java, have a look at GWT