Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 17th, 2006, 06:53 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 473 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 19 m 14 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Need to convert this completely to applet

the ajusted applet code that i had tryed to ajust is this...

Code:
package ip;

  import java.net.InetAddress;
  import java.net.NetworkInterface;
  import java.net.SocketException;
  import java.util.Enumeration;
  import javax.swing.JApplet;
  import javax.swing.JOptionPane;
  
  public class Addrs extends JApplet{
	  static String[] top=new String[20];
	  static double counter=0;
    public static void init(String[] args) throws SocketException {
      Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
  
      while (ifaces.hasMoreElements()) {
        NetworkInterface ni = (NetworkInterface)ifaces.nextElement();  
        Enumeration addrs = ni.getInetAddresses();  
        while (addrs.hasMoreElements()) {
          InetAddress ia = (InetAddress)addrs.nextElement();
          top[top.length]=ni.getName()+": " + ia.getHostAddress();
          counter++;
        }
      }
      for (int x=0;x<counter;x++) {
    	  JOptionPane.showMessageDialog(null,top[x]);
    	  System.out.println(top[x]);
      }
    }
  }


the original application code is

Code:
package ip;

  import java.net.InetAddress;
  import java.net.NetworkInterface;
  import java.net.SocketException;
  import java.util.Enumeration;
  
  public class Addrs {
    public static void main(String[] args) throws SocketException {
      Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
  
      while (ifaces.hasMoreElements()) {
        NetworkInterface ni = (NetworkInterface)ifaces.nextElement();
        System.out.println(ni.getName() + ":");
  
        Enumeration addrs = ni.getInetAddresses();
  
        while (addrs.hasMoreElements()) {
          InetAddress ia = (InetAddress)addrs.nextElement();
          System.out.println(" " + ia.getHostAddress());
        }
      }
    }
  }




Thanks,

colton22

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Need to convert this completely to applet


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT