URL u =null;
  long timestamp = 0;
  getImage(getDocumentBase(), "test.gif");  try {
     u = new URL(getDocumentBase(), "test.gif");
     URLConnection uc = u.openConnection();
     uc.setUseCaches(false);
     /*
     ** use timestamp has a reference, re-open an URLConnection
     ** to the same file to check if the timestamp is different
     ** with the getLastModified() method.
     */
     timestamp = uc.getLastModified();
     } 
  catch (Exception e) {
     e.printStackTrace();}
     }没隔一段时间去检查last modified time 可否?

解决方案 »

  1.   

    >>Well it depends on how often you want to do it and you do not want to poll. It is conceivable though to write a low priority thread to check the files last modified time stamp and say fires a property change event. (Somewhat along the lines of java.awt.MediaTracker) 
    public class FileMonitor implements Runnable {
      public static final String FILE_CHANGED_PROPERTY = "FILE_CHANGED_PROPERTY";
      private File fileToMonitor;
      private PropertychangeSupport;  public FileMonitor(File fileToMonitor)
      {
         this.fileToMonitor = fileToMonitor;
         pcs = new PropertychangeSupport(this);
      }  public void addPropertyChangeListener(PropertyChangeListener pcl)
      {
         pcs.addPropertyChangeListener(pcl);
      }  public void removePropertyChangeListener(PropertyChangeListener pcl)
      {
         pcs.removePropertyChangeListener(pcl);
      }  private Thread monitor;
      public void startMonitoring() {
        if (monitor != null) {
           monitor = new Thread(this, /* desired priority */);
           monitor.start();
        } 
      }
      
      private long lastModified = -1;
      public void run() {
         lastModified = fileToMonitor.lastModified();     // check the lastModified every so often
         // if there is a difference fire the event
      }
    }
      

  2.   

    Thanks go for skyyoung(路人甲)! 
    What i really want to know is which function i can use to refresh the current page rather than check the last modified page.
      

  3.   

    我想从新editPane.setPage(helpURL);可以吧。
      

  4.   

    any way, thank your idea, skyyoung(路人甲).Here 10 points for you. 
    cheers.