Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Java Warning Message (http://www.go4expert.com/forums/java-warning-message-t28773/)

reev007 23Jul2012 08:13

Java Warning Message
 
hello all, I have a problem with my program in java netBeans...
I created an IP monitoring program and there will be a "warning message" when there is a change of IP. This is a program that I created:
Code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        try{
InetAddress minta= InetAddress.getLocalHost();
jTextField1.setText(minta.getHostAddress());
jTextField2.setText(minta.getHostName());
FileWriter fstream = new FileWriter("List_IP.txt");
PrintWriter out = new PrintWriter(fstream);
out.write(minta.getHostAddress());
out.close();
                }catch (IOException e){//Catch exception if any
                        System.err.println("Error: " + e.getMessage());

program detects the IP and then save the file "txt".
program runs automatically, and when the IP changes, the program will give "warning message". I was wondering how to make it .. anyone can help me? pleaseee ......

ManzZup 4Aug2012 20:17

Re: Java Warning Message
 
make a daemon thread to monitor the change of IP
if any change that thread calls a the main program to notify of the change


All times are GMT +5.5. The time now is 00:02.