Class JTextComponentMatcher
- All Implemented Interfaces:
ComponentMatcher
,ResettableComponentMatcher
JTextComponent
by type, name or text.-
Field Summary
FieldsFields inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate
ANY, name
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIndicates that the
to match should be showing on the screen.JTextComponent
Specifies the text to match.Specifies the text to match.static JTextComponentMatcher
any()
Creates a new
that matches anyJTextComponentMatcher
.JTextComponent
protected boolean
isMatching
(JTextComponent button) Indicates whether the text of the given
is equal to the text in this matcher.JTextComponent
toString()
static JTextComponentMatcher
Creates a new
that matches aJTextComponentMatcher
that: has a matching name (optionally) has matching text (optionally) is showing on the screenJTextComponent
static JTextComponentMatcher
Creates a new
that matches aJTextComponentMatcher
by its text.JTextComponent
static JTextComponentMatcher
Creates a new
that matches aJTextComponentMatcher
by its text.JTextComponent
Methods inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate
arePropertyValuesMatching, isNameMatching, quoted, quotedName
Methods inherited from class org.fest.swing.core.GenericTypeMatcher
matches, supportedType
Methods inherited from class org.fest.swing.core.AbstractComponentMatcher
requireShowing, requireShowing, requireShowingMatches, reset
-
Field Details
-
text
-
-
Constructor Details
-
JTextComponentMatcher
-
-
Method Details
-
withName
Creates a new
that matches aJTextComponentMatcher
that:JTextComponent
- has a matching name
- (optionally) has matching text
- (optionally) is showing on the screen
The following code listing shows how to match a
by name and text:JTextComponent
JTextComponentMatcher m =
withName
("lastName").andText
("Wang");The following code listing shows how to match a
, that should be showing on the screen, by name and text:JTextComponent
JTextComponentMatcher m =
withName
("lastName").andText
("Wang").andShowing
();- Parameters:
name
- the id to match.- Returns:
- the created matcher.
-
withText
Creates a new
that matches aJTextComponentMatcher
by its text.JTextComponent
The following code listing shows how to match a
by text:JTextComponent
JTextComponentMatcher m =
withText
("Wang");The following code listing shows how to match a
, that should be showing on the screen, by text:JTextComponent
JTextComponentMatcher m =
withText
("Wang").andShowing
();- Parameters:
text
- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
withText
Creates a new
that matches aJTextComponentMatcher
by its text.JTextComponent
The following code listing shows how to match a
by text, using a regular expression pattern:JTextComponent
JTextComponentMatcher m =
withText
(Pattern.compile("W.*"));The following code listing shows how to match a
, that should be showing on the screen, by text, using a regular expression pattern:JTextComponent
JTextComponentMatcher m =
withText
(Pattern.compile("W.*")).andShowing
();- Parameters:
textPattern
- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
any
Creates a new
that matches anyJTextComponentMatcher
.JTextComponent
- Returns:
- the created matcher.
-
andText
Specifies the text to match. If this matcher was created using
orwithText(String)
, this method will simply update the text to match.withText(Pattern)
- Parameters:
newText
- the new text to match. It can be a regular expression.- Returns:
- this matcher.
-
andText
Specifies the text to match. If this matcher was created using
orwithText(String)
, this method will simply update the text to match.withText(Pattern)
- Parameters:
textPattern
- the regular expression pattern to match.- Returns:
- this matcher.
- Since:
- 1.2
-
andShowing
Indicates that the
to match should be showing on the screen.JTextComponent
- Returns:
- this matcher.
-
isMatching
Indicates whether the text of the given
is equal to the text in this matcher.JTextComponent
Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
isMatching
in classGenericTypeMatcher<JTextComponent>
- Parameters:
button
- theJTextComponent
to match.- Returns:
true
if the text in theJTextComponent
is equal to the text in this matcher,false
otherwise.
-
toString
-