Package org.fest.swing.finder
Class WindowFinder
java.lang.Object
org.fest.swing.finder.WindowFinder
Understands lookup of s and Frames. 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 DialogFinderfindDialog(Class<? extends Dialog> dialogType) Creates a newcapable of looking up aDialogFinderby type.Dialogstatic DialogFinderfindDialog(String dialogName) Creates a newcapable of looking up aDialogFinderby name.Dialogstatic DialogFinderfindDialog(GenericTypeMatcher<? extends Dialog> matcher) Creates a newcapable of looking up aDialogFinderusing the provided matcher.Dialogstatic FrameFinderCreates a newcapable of looking up aFrameFinderby type.Framestatic FrameFinderCreates a newcapable of looking up aFrameFinderby name.Framestatic FrameFinderfindFrame(GenericTypeMatcher<? extends Frame> matcher) Creates a newcapable of looking up aFrameFinderusing the provided matcher.Frame
-
Constructor Details
-
WindowFinder
private WindowFinder()
-
-
Method Details
-
findFrame
Creates a newcapable of looking up aFrameFinderby name.Frame- Parameters:
frameName- the name of the frame to find.- Returns:
- the created finder.
-
findFrame
Creates a newcapable of looking up aFrameFinderby type.Frame- Parameters:
frameType- the type of the frame to find.- Returns:
- the created finder.
-
findFrame
Creates a newcapable of looking up aFrameFinderusing the provided matcher.Frame- Parameters:
matcher- the matcher to use to find a frame.- Returns:
- the created finder.
-
findDialog
Creates a newcapable of looking up aDialogFinderby name.Dialog- Parameters:
dialogName- the name of the dialog to find.- Returns:
- the created finder.
-
findDialog
Creates a newcapable of looking up aDialogFinderby type.Dialog- Parameters:
dialogType- the type of the dialog to find.- Returns:
- the created finder.
-
findDialog
Creates a newcapable of looking up aDialogFinderusing the provided matcher.Dialog- Parameters:
matcher- the matcher to use to find a dialog.- Returns:
- the created finder.
-