Post: [Java]: Site IP Finder!
11-22-2008, 05:34 AM #1
Impulser
Save Point
(adsbygoogle = window.adsbygoogle || []).push({}); You must login or register to view this content.

    import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.InetAddress;
import java.net.UnknownHostException;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;

/**
* Summary description for Main
*
*/
public class Main extends JFrame {
private static final long serialVersionUID = 1L;
private JLabel jLabel1;
private JLabel jLabel2;
private JTextField jTextField1;
private JTextField jTextField2;
private JButton jButton1;
private JButton jButton2;
private JPanel contentPane;

/**
* Creates a new main class.
*/
public Main() {
super();
initializeComponent();
setVisible(true);
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Windows Form Designer. Otherwise, retrieving design
* might not work properly. Tip: If you must revise this method, please
* backup this GUI file for JFrameBuilder to retrieve your design properly
* in future, before revising this method.
*/
private void initializeComponent() {
jLabel1 = new JLabel();
jLabel2 = new JLabel();
jTextField1 = new JTextField();
jTextField2 = new JTextField();
jButton1 = new JButton();
jButton2 = new JButton();
contentPane = (JPanel) getContentPane();
/**
* jLabel1
*/
jLabel1.setText("Site\'s Domain:");
/**
* jLabel2
*/
jLabel2.setText("Site\'s IP:");
/**
* jButton1
*/
jButton1.setText("Find IP");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String address = InetAddress.getByName(
jTextField1.getText()).toString();
jTextField2.setText(address
.substring(address.indexOf('/'Winky Winky + 1));
} catch (UnknownHostException ex) {
jTextField2.setText("Unknown Host");
}
}
});
/**
* jButton2
*/
jButton2.setText("Clear");
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jTextField1.setText("");
jTextField2.setText("");
}

});
/**
* contentPane
*/
contentPane.setLayout(null);
addComponent(contentPane, jLabel1, 6, 11, 73, 1Cool Man (aka Tustin);
addComponent(contentPane, jLabel2, 178, 46, 60, 1Cool Man (aka Tustin);
addComponent(contentPane, jTextField1, 74, 11, 313, 20);
addComponent(contentPane, jTextField2, 221, 45, 166, 20);
addComponent(contentPane, jButton1, 5, 41, 78, 27);
addComponent(contentPane, jButton2, 90, 41, 78, 27);
/**
* Main outline of the frame
*/
setTitle("Site IP Finder");
this.setLocation(new Point(0, 0));
this.setSize(new Dimension(408, 112));
}

/**
* Add Component Without a Layout Manager (Absolute Positioning)
*/
private void addComponent(Container container, Component c, int x, int y,
int width, int height) {
c.setBounds(x, y, width, height);
container.add(c);
}

/**
* Main method first method called.
*
* @param args
*/
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception ex) {
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
Main main = new Main();
main.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}
(adsbygoogle = window.adsbygoogle || []).push({});
11-22-2008, 05:47 AM #2
magglass1
S3rv0r @dm1n
Did you write that yourself or find it online somewhere? If you wrote it yourself, good job.

Btw, I prefer using nslookup to find IP addresses:

root@slack12:~# nslookup [url]www.nextgenupdate.com[/url]
Server: 192.168.1.1
Address: 192.168.1.1#53

Non-authoritative answer:
[url]www.nextgenupdate.com[/url] canonical name = nextgenupdate.com.
Name: nextgenupdate.com
Address: 75.101.138.215
11-22-2008, 06:13 AM #3
Impulser
Save Point
Made it myself...

If you good it you might find it on a different site under the name of "Linux" but thats me...

Thanks for the comment...
11-22-2008, 02:55 PM #4
Thanks! I'm gonna look through this because I'm currently taking Introduction to Java this semester and next semester Advanced Java. So, I'm definitely going to look at this, thanks again.
12-09-2008, 03:51 AM #5
Aerial
Maggbot timeout!
I think he is ripping. 'If you find on another website of name Linux thats me'

Can't find this so called website. He has 8 posts.

Link to this website please?

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo