The problem with trying to use a standard ping program to see if a machine will respond is that many machines and networks simply drop these sorts of requests so no response could mean various things.
There are other ways to find out if a machine is running at an IP address. NMAP, Nessus can certainly do it, I have found that if NMAP or Nessus can't return any results at all, nothing will.
The most straightforward way in Java to
test whether a port is open(which I am assuming that is what you meant) is to try to connect to port number with a TCP socket and also try sending a UDP datagram to it and see what if anything happens. To control this via a JButton, simply start the object that runs this simple port scanner with the button's listener.
You could also write a program to send a single ACK, SYN, or FIN packet to all possible ports and see if any are open, though if they are all stealthed you won't learn anything useful. A traceroute program that is a little sneaky and uses UDP, ACK, SYN, or FIN sometimes gets through networks that drop ICMP traffic. They won't respond to ICMP based traceroute but are happy to send back a time exceeded ICMP message for TCP or UDP traffic.
These last two can't be done with only the Java API, you need to either write your own JNI wrapper around libpcap or use existing ones like Jpcap and jpcap.