You can use the following code snippet to obtain the current user name. In applets, there is no way unless you ask for it or use a signed applet.

 String username;
username = System.getProperty("user.name");