Java Warning Message

reev007's Avatar, Join Date: Jul 2012
Newbie Member
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 ......

Last edited by shabbir; 23Jul2012 at 10:21.. Reason: Code blocks
ManzZup's Avatar, Join Date: May 2009
Skilled contributor
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