Code of A Java Counter
May 21, 2009, Posted by admin at 9:50 am
// Used to get the user name. special crdits to Robert Scott at the
// Java message base for the tech part and Mig9 for the motivation part.
// Amit C. (ConnectSoft Ruksun, Pune, India) amit@maverick.corus.co.in
import java.applet.Applet;
import java.awt.Graphics;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class urname extends Applet
{
InetAddress myAddress= null;
public void init()
{
try
{
myAddress = InetAddress.getLocalHost();
}
catch(UnknownHostException e){}
}
public void paint(Graphics g)
{
g.drawString(”Welcome ” + myAddress.getHostName() +”!”, 10, 20);
// g.drawString(myAddress.toString(), 10, 20);
}
}

You must be logged in to post a comment.