content: package screentask;
  
  import java.net.Inet4Address;
  import java.net.InetAddress;
  import java.net.NetworkInterface;
  import java.net.SocketException;
  import java.net.UnknownHostException;
  import java.util.Enumeration;
  import javax.swing.JComboBox;
  
  public class Network {
      public static void LoadIps(JComboBox<String> combo) throws SocketException {
          Enumeration<NetworkInterface> n = NetworkInterface.getNetworkInterfaces();
          for (; n.hasMoreElements();) {
              NetworkInterface e = n.nextElement();
  
              Enumeration<InetAddress> a = e.getInetAddresses();
              for (; a.hasMoreElements();) {
                  InetAddress addr = a.nextElement();
                  String getHostAddress = addr.getHostAddress();
  
                  if (checkIPv4(getHostAddress)) {
                      combo.addItem(addr.getHostAddress() + " # " + e.getDisplayName());
                  }
              }
          }
      }
      
      public static final boolean checkIPv4(final String ip) {
          boolean isIPv4;
          try {
              final InetAddress inet = InetAddress.getByName(ip);
              isIPv4 = inet.getHostAddress().equals(ip)
                      && inet instanceof Inet4Address;
          } catch (final UnknownHostException e) {
              isIPv4 = false;
          }
          return isIPv4;
      }
  }
  