Package org.fest.swing.core.matcher
Class JLabelMatcher
java.lang.Object
org.fest.swing.core.AbstractComponentMatcher
org.fest.swing.core.GenericTypeMatcher<T>
org.fest.swing.core.matcher.NamedComponentMatcherTemplate<JLabel>
org.fest.swing.core.matcher.JLabelMatcher
- All Implemented Interfaces:
ComponentMatcher,ResettableComponentMatcher
Understands matching a
JLabel 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.JLabelSpecifies the text to match.Specifies the text to match.static JLabelMatcherany()Creates a newthat matches anyJLabelMatcher.JLabelprotected booleanisMatching(JLabel button) Indicates whether the text of the givenis equal to the text in this matcher.JLabeltoString()static JLabelMatcherCreates a newthat matches aJLabelMatcherthat: has a matching name (optionally) has matching text (optionally) is showing on the screenJLabelstatic JLabelMatcherCreates a newthat matches aJLabelMatcherby its text.JLabelstatic JLabelMatcherCreates a newthat matches aJLabelMatcherby its text.JLabelMethods 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
-
JLabelMatcher
-
-
Method Details
-
withName
Creates a newthat matches aJLabelMatcherthat:JLabel- 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:JLabelJLabelMatcher m =
withName("firstName").andText("First Name:");The following code listing shows how to match a
, that should be showing on the screen, by name and text:JLabelJLabelMatcher m =
withName("firstName").andText("First Name:").andShowing();- Parameters:
name- the id to match.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJLabelMatcherby its text.JLabelThe following code listing shows how to match a
by text:JLabelJLabelMatcher m =
withText("First Name:");The following code listing shows how to match a
, that should be showing on the screen, by text:JLabelJLabelMatcher m =
withText("First Name:").andShowing();- Parameters:
text- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJLabelMatcherby its text.JLabelThe following code listing shows how to match a
by text:JLabelJLabelMatcher m =
withText(Pattern.compile("F.*");The following code listing shows how to match a
, that should be showing on the screen, by text:JLabelJLabelMatcher m =
withText(Pattern.compile("F.*").andShowing();- Parameters:
textPattern- the regular expression pattern to match.- Returns:
- the created matcher.
- Since:
- 1.2
-
any
Creates a newthat matches anyJLabelMatcher.JLabel- 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.JLabel- Returns:
- this matcher.
-
isMatching
Indicates whether the text of the givenis equal to the text in this matcher.JLabelNote: 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<JLabel>- Parameters:
button- theJLabelto match.- Returns:
trueif the text in theJLabelis equal to the text in this matcher,falseotherwise.
-
toString
-