You can use the following code snippet to get the IP address in an applet:

   String ip = (new Socket(getDocumentBase().getHost(), getDocumentBase().getPort()))
    .getLocalAddress().getHostAddress();