|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.finder.ComponentFinderTemplate<JOptionPane>
org.fest.swing.finder.JOptionPaneFinder
public class JOptionPaneFinder
Understands a finder for
s. 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.
JOptionPane
This example illustrates finding a
by name, using the default lookup time (5
seconds):
JOptionPane
JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().using(robot);
Where robot
is an instance of
.
Robot
This example shows how to find a
by type using a lookup time of 10 seconds:
JOptionPane
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
using a JOptionPane
:
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);
Constructor Summary | |
---|---|
protected |
JOptionPaneFinder()
Creates a new JOptionPaneFinder . |
protected |
JOptionPaneFinder(GenericTypeMatcher<? extends JOptionPane> matcher)
Creates a new JOptionPaneFinder . |
Method Summary | |
---|---|
protected JOptionPane |
cast(Component c)
Casts the given Component to . |
static JOptionPaneFinder |
findOptionPane()
Creates a new capable of looking up a . |
static JOptionPaneFinder |
findOptionPane(GenericTypeMatcher<? extends JOptionPane> matcher)
Creates a new capable of looking up a
using the given matcher. |
JOptionPaneFixture |
using(Robot robot)
Finds a by name or type. |
JOptionPaneFinder |
withTimeout(long timeout)
Sets the timeout for this finder. |
JOptionPaneFinder |
withTimeout(long timeout,
TimeUnit unit)
Sets the timeout for this finder. |
Methods inherited from class org.fest.swing.finder.ComponentFinderTemplate |
---|
findComponentWith |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected JOptionPaneFinder()
JOptionPaneFinder
. This finder looks up a JOptionPane
by
type.
protected JOptionPaneFinder(GenericTypeMatcher<? extends JOptionPane> matcher)
JOptionPaneFinder
.
matcher
- specifies the search criteria to use when looking up a JOptionPane
.Method Detail |
---|
public static JOptionPaneFinder findOptionPane()
JOptionPaneFinder
capable of looking up a JOptionPane
.
public static JOptionPaneFinder findOptionPane(GenericTypeMatcher<? extends JOptionPane> matcher)
JOptionPaneFinder
capable of looking up a JOptionPane
using the given matcher.
matcher
- the given matcher.
public JOptionPaneFixture using(Robot robot)
JOptionPane
by name or type.
using
in class ComponentFinderTemplate<JOptionPane>
robot
- contains the underlying finding to delegate the search to.
JOptionPaneFixture
managing the found JOptionPane
.
WaitTimedOutError
- if a JOptionPane
could not be found.public JOptionPaneFinder withTimeout(long timeout)
withTimeout
in class ComponentFinderTemplate<JOptionPane>
timeout
- the number of milliseconds before stopping the search.
public JOptionPaneFinder withTimeout(long timeout, TimeUnit unit)
withTimeout
in class ComponentFinderTemplate<JOptionPane>
timeout
- the period of time the search should be performed.unit
- the time unit for timeout
.
protected JOptionPane cast(Component c)
Component
to JOptionPane
.
cast
in class ComponentFinderTemplate<JOptionPane>
c
- the given Component
.
Component
, casted to JFileChooser
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |