Myanmar IT Resource Forum
Myanmar IT Resource Forum

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 IP Lookup with java [Problem] on 18th January 2010, 8:13 pm

C0D3R


MITR Master



MITR Master
ေအာက္ကကုတ္ေလးကေတာ႔ အိုင္ပီၾကည္႔ဖို႕အတြက္ java ကုတ္ေလးပါ

Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.net.*;


public class ip extends JFrame {
  // Anfang Attribute
  private JTextField jTextField1 = new JTextField();
  private JLabel jLabel1 = new JLabel();
  private JButton jButton1 = new JButton();
  // Ende Attribute

  public ip (String title) {
        // Frame-Initialisierung
        super (title);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        int frameWidth = 263;
        int frameHeight = 199;
        setSize(frameWidth, frameHeight);
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (d.width - getSize().width) / 2;
        int y = (d.height - getSize().height) / 2;
        setLocation(x, y);
        Container cp = getContentPane();
        cp.setLayout(null);
        // Anfang Komponenten

        jTextField1.setBounds(24, 0, 201, 24);
        jTextField1.setText("bifrostworld.org");
        cp.add(jTextField1);
        jLabel1.setBounds(16, 112, 212, 48);
        jLabel1.setText("IP....");
        jLabel1.setFont(new Font("MS Sans Serif", Font.PLAIN, 13));
        cp.add(jLabel1);
        jButton1.setBounds(80, 48, 81, 41);
        jButton1.setText("getIP");
        jButton1.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
                jButton1_ActionPerformed(evt);
          }
        });
        cp.add(jButton1);
        // Ende Komponenten

        setResizable(false);
        setVisible(true);
  }

  // Anfang Methoden
  public void jButton1_ActionPerformed(ActionEvent evt) {
        String host = jTextField1.getText();
        try{
          jLabel1.setText(InetAddress.getByName(host).getHostAddress());
        }
        catch(Exception e){
        System.out.println(e);
        }

       
  }

  // Ende Methoden

  public static void main(String[] args) {
        new ip("ip");
  }
}

http://www.myanmaritresource.info

2 Re: IP Lookup with java [Problem] on 4th March 2010, 10:31 pm

roadking


MITR New User



လုပ္ပုံလုပ္နည္းေျပာျပပါလား ဗ်ာ

3 Re: IP Lookup with java [Problem] on 5th March 2010, 5:23 pm

C0D3R


MITR Master



MITR Master
roadking wrote:လုပ္ပုံလုပ္နည္းေျပာျပပါလား ဗ်ာ

ဒါက Code ေလ အဲဒါကိုျပန္ Run ရမွာ

http://www.myanmaritresource.info

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum

 

Forum create on Forumotion | © PunBB | Free forum support | Contact | Report an abuse | Forumotion.com