1 Reply Latest reply on Oct 7, 2004 11:11 PM by 807587

    One thread closes a popup in another thread

      I am trying to write some unit tests for some custom JOptionPane's.

      I am using a loop call showConfirmPane(...) over and over... I would like to have another thread be able to click "yes" each time a popup appears.

      How could I make a second thread call doClick() or something like that whenever there is a popup? How can I focus on the button?? Thanks

        • 1. Re: One thread closes a popup in another thread
          Solved it by using a keyboard focus manager to listen for property change events.

          If the property name was focus owner, then i recursively search up the inheritance heirarchy and check each component to see if it's an instance of my custom JOptionPane. If I find it, then I just dispose of it.

          The buttons would get focus when a new popup was shown, and the other thread would receive the property change events and dispose of the windows ;)