コード例 #1
0
  void test3(Window owner, Window child1, Window child2) {
    System.out.println("* * * STAGE 3 * * *\nWidow owner: " + owner);

    owner.setFocusableWindowState(true);
    owner.setVisible(true);

    child1.setFocusableWindowState(false);
    child1.setVisible(true);

    child2.setFocusableWindowState(true);
    child2.add(button);
    child2.setVisible(true);

    Util.waitTillShown(child2);

    Util.clickOnComp(button, robot);
    System.err.println(
        "focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
    if (button != KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
      throw new RuntimeException("Test failed.");
    }
    child1.dispose();
    child2.dispose();
    owner.dispose();
  }
コード例 #2
0
  void test1(Window owner, Window child) {
    System.out.println("* * * STAGE 1 * * *\nWindow owner: " + owner);

    owner.setFocusableWindowState(false);
    owner.setVisible(true);

    child.add(button);
    child.setVisible(true);

    Util.waitTillShown(child);

    Util.clickOnComp(button, robot);
    if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
      throw new RuntimeException("Test Failed.");
    }
    child.dispose();
    owner.dispose();
  }