FileDocCategorySizeDatePackage
ProgressThread.javaAPI DocJMF 2.1.1e1847Mon May 12 12:20:30 BST 2003jmapps.ui

ProgressThread

public class ProgressThread extends Thread
This thread class is used by SaveAsDialog to monitor the progress of saving the file and updating the Progress dialog.

Fields Summary
private Processor
processor
private ProgressDialog
dlgProgress
private boolean
boolTerminate
private boolean
boolSuspended
Constructors Summary
public ProgressThread(Processor processor, ProgressDialog dlgProgress)
This constructor creates object ProgressThread.

param
processor processor, that does file save
param
dlgProgress Progress dialog



                                      
            
        this.processor = processor;
        this.dlgProgress = dlgProgress;
    
Methods Summary
public synchronized voidpauseThread()

        boolSuspended = true;
    
public synchronized voidresumeThread()

        boolSuspended = false;
        notify ();
    
public voidrun()

        int    nPos;
	
        boolTerminate = false;
        while ( !boolTerminate && !this.isInterrupted() ) {
            try {
                sleep ( 200 );
                if ( boolSuspended == true ) {
                    synchronized ( this ) {
                        while ( boolSuspended )
                            wait ();
                    }
                }
		
		nPos = (int) processor.getMediaTime().getSeconds();
		dlgProgress.setCurPos ( nPos );
            }catch ( Exception exception ) {
		boolTerminate = true;
		break;
            }
        }
    
public synchronized voidterminateNormaly()

        boolTerminate = true;
	try {
	    this.interrupt();
	} catch (Exception ex) {}