Java Warning Message

Discussion in 'Java' started by reev007, Jul 23, 2012.

  1. reev007

    reev007 New Member

    Joined:
    Jul 23, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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 a moderator: Jul 23, 2012
  2. ManzZup

    ManzZup New Member

    Joined:
    May 9, 2009
    Messages:
    278
    Likes Received:
    43
    Trophy Points:
    0
    Occupation:
    Production Manager:Software @ ZONTEK
    Location:
    Sri Lanka
    Home Page:
    http://zontek.zzl.org
    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
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice