コード例 #1
0
 public void testWaitForDialogWithActiveWindowAsTargetDialog() throws InterruptedException {
   JFrame frame = new JFrame();
   JDialog testDialog = new JDialog(frame, "testDialog");
   setFocusManager(testDialog);
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, testDialog));
   windowContext.waitForDialogOpening("testDialog", 10);
   assertSame(testDialog, windowContext.activeWindow());
   testDialog.dispose();
   frame.dispose();
 }
コード例 #2
0
 public void testWaitForActiveDialogWhenDialogIsNotReady() throws InterruptedException {
   final JDialog testDialog = new JDialog(new JFrame(), "testDialog");
   setFocusManager(testDialog);
   new Thread(
           new Runnable() {
             public void run() {
               windowContext.propertyChange(
                   new PropertyChangeEvent(this, "focusOwner", null, testDialog));
             }
           })
       .start();
   windowContext.waitForDialogOpening("testDialog", 10);
   assertEquals(testDialog, windowContext.activeWindow());
   testDialog.dispose();
 }