Export (0) Print
Expand All

Object.wait Method

Pauses a process.


public void wait()

Called

The most common use for this method is to start an object that asks the user for some input and then call the wait method on that object (for example, a form). The next line of code is not executed until the object has called a notify or notifyAll method.

When the wait method is called from a form, you do not have to call the notify methods manually because forms call the Object.notifyAll method when the user either closes the form or presses Apply.

NoteNote

This method is not meant for thread synchronization. Use the Thread.waitUntilSignaled Method instead.


The following example opens the GetUserInput dialog; blocks and waits until the user has closed the from.

{
    Args a = new Args("GetUserInput");
    formRun fr = new formRun(a);
    ;

    fr.init();
    fr.run();
    fr.wait();
 
    // Execution will resume at this point, only after
    // the user has closed the form.
}

Community Additions

ADD
Show:
© 2015 Microsoft