import java.awt.*; import javax.swing.*; public class MonitorExecution implements Runnable { private Thread t; private JTextField tf; private boolean debug; public MonitorExecution(Thread t, JTextField tf, boolean debug) { this.t = t; this.tf = tf; this.debug = debug; if(debug) System.out.println("MonitorExecution constructor completed"); } public void run(){ while(t.isAlive()) { waitFor(100); } tf.setText("completed"); AdcircFrame1.setExecutionCompleted(); } public synchronized void waitFor(long howLong){ try { wait(howLong); } catch (Exception e) { System.out.println(e);} } }