Common-Use Component Matchers
By default, FEST-Swing supports looking up components by name, type and custom search criteria. To specify custom search criteria, users need to provide an implementation of GenericTypeMatcher or ComponentMatcher.
To save development time, FEST-Swing provides some common-use component matchers in the package org.fest.swing.core.matcher:
| Matcher | Description |
DialogMatcher
| Matches a Dialog containing the specified name and/or title
|
FrameMatcher
| Matches a Frame containing the specified name and/or title
|
JButtonMatcher
| Matches a JButton containing the specified name and/or text
|
JLabelMatcher
| Matches a JLabel containing the specified name and/or text
|
JTextComponentMatcher
| Matches a JTextComponent containing the specified name and/or text
|
Example
The following example shows how to find and click a JButton with name "cancel" and text "Cancel", in a Frame using a JButtonMatcher:
// import static org.fest.swing.core.matcher.JButtonMatcher.withText; FrameFixture frame = new FrameFixture(new MyFrame()); frame.button(withName("cancel").andText("Cancel")).click();
