01: package abbot.finder;
02:
03: import java.awt.Component;
04:
05: /** Provides an indication whether a Component matches some desired
06: criteria. For use with implementations of {@link ComponentFinder}.
07: You can conveniently inline a custom matcher like so:<br>
08: <pre><code>
09: ComponentFinder finder;
10: ...
11: // Find a label with known text
12: JLabel label = (JLabel)finder.find(new Matcher() {
13: public boolean matches(Component c) {
14: return c instanceof JLabel
15: && "expected text".equals(((JLabel)c).getText());
16: }
17: });
18: </code></pre>
19: @see ComponentFinder
20: */
21: public interface Matcher {
22: /** Return whether the given Component matches some lookup criteria. */
23: boolean matches(Component c);
24: }
|