Class JOptionPaneFinder


public class JOptionPaneFinder extends ComponentFinderTemplate<JOptionPane>
Understands a finder for JOptionPanes. Lookups are performed till a file chooser is found, or until the given time to perform the lookup is over. The default lookup time is 5 seconds.

This example illustrates finding a JOptionPane by name, using the default lookup time (5 seconds):

 JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().using(robot);
 

Where robot is an instance of Robot.

This example shows how to find a JOptionPane by type using a lookup time of 10 seconds:

 JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(10000).using(robot);
 
We can also specify the time unit:
 JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(10, SECONDS).using(robot);
 

This example shows how to find a JOptionPane using a GenericTypeMatcher:

 GenericTypeMatcher<JOptionPane> matcher = new GenericTypeMatcher<JOptionPane>() {
   protected boolean isMatching(JOptionPane optionPane) {
     return "A message".equals(optionPane.getMessage());
   }
 };
 JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane(matcher).using(robot);