public final class FrameMatcher extends NamedComponentMatcherTemplate<Frame>
Frames by name, title or visibility on the screen.| Modifier and Type | Method and Description |
|---|---|
FrameMatcher |
andShowing()
Indicates that the AWT or Swing
Frame to match should be showing on the screen. |
FrameMatcher |
andTitle(Pattern titlePattern)
Specifies the title to match.
|
FrameMatcher |
andTitle(String newTitle)
Specifies the title to match.
|
static FrameMatcher |
any()
Creates a new
FrameMatcher that matches any java.awt.Frame. |
protected boolean |
isMatching(Frame frame)
Indicates whether the name and title of the given AWT or Swing
Frame match the ones in this matcher. |
String |
toString() |
static FrameMatcher |
withName(String name)
Creates a new
FrameMatcher that matches an AWT or Swing Frame by name. |
static FrameMatcher |
withTitle(Pattern pattern)
Creates a new
FrameMatcher that matches an AWT or Swing Frame by title. |
static FrameMatcher |
withTitle(String title)
Creates a new
FrameMatcher that matches an AWT or Swing Frame by title. |
anyValue, arePropertyValuesMatching, isNameMatching, name, quoted, quotedNamematches, supportedTyperequireShowing, requireShowing, requireShowingMatches, resetpublic static FrameMatcher withName(@Nullable String name)
Creates a new FrameMatcher that matches an AWT or Swing Frame by name.
The following code listing shows how to match a Frame by name and title:
FrameMatcher m =withName("myApp").andTitle("My App");
The following code listing shows how to match a Frame, that should be showing on the screen, by name and
title:
FrameMatcher m =withName("myApp").andTitle("My App").andShowing();
name - the id to match.public static FrameMatcher withTitle(@Nonnull String title)
Creates a new FrameMatcher that matches an AWT or Swing Frame by title.
The following code listing shows how to match a Frame by title:
FrameMatcher m = withTitle("My App");
The following code listing shows how to match a Frame, that should be showing on the screen, by title:
FrameMatcher m =withTitle("My App").andShowing();
title - the title to match. It can be a regular expression.@Nonnull public static FrameMatcher withTitle(@Nonnull Pattern pattern)
Creates a new FrameMatcher that matches an AWT or Swing Frame by title.
The following code listing shows how to match a Frame by title, using a regular expression matcher:
FrameMatcher m = withTitle(Pattern.compile("My.*"));
The following code listing shows how to match a Frame, that should be showing on the screen, by title:
FrameMatcher m =withTitle(Pattern.compile("My.*")).andShowing();
pattern - the title to match.@Nonnull public static FrameMatcher any()
FrameMatcher that matches any java.awt.Frame.@Nonnull public FrameMatcher andTitle(@Nonnull String newTitle)
withTitle(String) or
withTitle(Pattern), this method will simply update the title to match.newTitle - the new title to match. It can be a regular expression.@Nonnull public FrameMatcher andTitle(@Nonnull Pattern titlePattern)
withTitle(String) or
withTitle(Pattern), this method will simply update the title to match.titlePattern - the regular expression pattern to match.@Nonnull public FrameMatcher andShowing()
Frame to match should be showing on the screen.@RunsInCurrentThread protected boolean isMatching(@Nonnull Frame frame)
Indicates whether the name and title of the given AWT or Swing Frame match the ones in this matcher.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
isMatching in class GenericTypeMatcher<Frame>frame - the Frame to match.true if the title in the Frame is equal to the title in this matcher, false
otherwise.Copyright © 2014 AssertJ. All rights reserved.