Package org.fest.swing.finder
Class WindowFinder
java.lang.Object
org.fest.swing.finder.WindowFinder
Understands lookup of
s and Frame
s. Lookups are performed till
the window of interest is found, or until the given time to perform the lookup is over. The default lookup time is 5
seconds.
Dialog
is the "entry point" of a fluent interface to look up frames and
dialogs. This example illustrates finding a WindowFinder
by name, using the default lookup time (5
seconds):
Frame
FrameFixture frame = WindowFinder.findFrame("someFrame").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:
Dialog
DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10000).using(robot);We can also specify the time unit:
DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10, SECONDS
).using(robot);
This example shows how to use a
to find a GenericTypeMatcher
with
title "Hello":
Frame
GenericTypeMatcher<JFrame> matcher = new GenericTypeMatcher<JFrame>() { protected boolean isMatching(JFrame frame) { return "hello".equals(frame.getTitle()); } }; FrameFixture frame = WindowFinder.findFrame(matcher).using(robot);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DialogFinder
findDialog
(Class<? extends Dialog> dialogType) Creates a new
capable of looking up aDialogFinder
by type.Dialog
static DialogFinder
findDialog
(String dialogName) Creates a new
capable of looking up aDialogFinder
by name.Dialog
static DialogFinder
findDialog
(GenericTypeMatcher<? extends Dialog> matcher) Creates a new
capable of looking up aDialogFinder
using the provided matcher.Dialog
static FrameFinder
Creates a new
capable of looking up aFrameFinder
by type.Frame
static FrameFinder
Creates a new
capable of looking up aFrameFinder
by name.Frame
static FrameFinder
findFrame
(GenericTypeMatcher<? extends Frame> matcher) Creates a new
capable of looking up aFrameFinder
using the provided matcher.Frame
-
Constructor Details
-
WindowFinder
private WindowFinder()
-
-
Method Details
-
findFrame
Creates a new
capable of looking up aFrameFinder
by name.Frame
- Parameters:
frameName
- the name of the frame to find.- Returns:
- the created finder.
-
findFrame
Creates a new
capable of looking up aFrameFinder
by type.Frame
- Parameters:
frameType
- the type of the frame to find.- Returns:
- the created finder.
-
findFrame
Creates a new
capable of looking up aFrameFinder
using the provided matcher.Frame
- Parameters:
matcher
- the matcher to use to find a frame.- Returns:
- the created finder.
-
findDialog
Creates a new
capable of looking up aDialogFinder
by name.Dialog
- Parameters:
dialogName
- the name of the dialog to find.- Returns:
- the created finder.
-
findDialog
Creates a new
capable of looking up aDialogFinder
by type.Dialog
- Parameters:
dialogType
- the type of the dialog to find.- Returns:
- the created finder.
-
findDialog
Creates a new
capable of looking up aDialogFinder
using the provided matcher.Dialog
- Parameters:
matcher
- the matcher to use to find a dialog.- Returns:
- the created finder.
-