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 theto match should be showing on the screen.JTextComponentSpecifies the text to match.Specifies the text to match.static JTextComponentMatcherany()Creates a newthat matches anyJTextComponentMatcher.JTextComponentprotected booleanisMatching(JTextComponent button) Indicates whether the text of the givenis equal to the text in this matcher.JTextComponenttoString()static JTextComponentMatcherCreates a newthat matches aJTextComponentMatcherthat: has a matching name (optionally) has matching text (optionally) is showing on the screenJTextComponentstatic JTextComponentMatcherCreates a newthat matches aJTextComponentMatcherby its text.JTextComponentstatic JTextComponentMatcherCreates a newthat matches aJTextComponentMatcherby its text.JTextComponentMethods inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate
arePropertyValuesMatching, isNameMatching, quoted, quotedNameMethods inherited from class org.fest.swing.core.GenericTypeMatcher
matches, supportedTypeMethods inherited from class org.fest.swing.core.AbstractComponentMatcher
requireShowing, requireShowing, requireShowingMatches, reset
-
Field Details
-
text
-
-
Constructor Details
-
JTextComponentMatcher
-
-
Method Details
-
withName
Creates a newthat matches aJTextComponentMatcherthat: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:JTextComponentJTextComponentMatcher 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:JTextComponentJTextComponentMatcher m =
withName("lastName").andText("Wang").andShowing();- Parameters:
name- the id to match.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJTextComponentMatcherby its text.JTextComponentThe following code listing shows how to match a
by text:JTextComponentJTextComponentMatcher m =
withText("Wang");The following code listing shows how to match a
, that should be showing on the screen, by text:JTextComponentJTextComponentMatcher m =
withText("Wang").andShowing();- Parameters:
text- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJTextComponentMatcherby its text.JTextComponentThe following code listing shows how to match a
by text, using a regular expression pattern:JTextComponentJTextComponentMatcher 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:JTextComponentJTextComponentMatcher 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 newthat matches anyJTextComponentMatcher.JTextComponent- Returns:
- the created matcher.
-
andText
Specifies the text to match. If this matcher was created usingorwithText(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 usingorwithText(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 theto match should be showing on the screen.JTextComponent- Returns:
- this matcher.
-
isMatching
Indicates whether the text of the givenis equal to the text in this matcher.JTextComponentNote: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Specified by:
isMatchingin classGenericTypeMatcher<JTextComponent>- Parameters:
button- theJTextComponentto match.- Returns:
trueif the text in theJTextComponentis equal to the text in this matcher,falseotherwise.
-
toString
-