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 the
to match should be showing on the screen.JLabel
Specifies the text to match.Specifies the text to match.static JLabelMatcher
any()
Creates a new
that matches anyJLabelMatcher
.JLabel
protected boolean
isMatching
(JLabel button) Indicates whether the text of the given
is equal to the text in this matcher.JLabel
toString()
static JLabelMatcher
Creates a new
that matches aJLabelMatcher
that: has a matching name (optionally) has matching text (optionally) is showing on the screenJLabel
static JLabelMatcher
Creates a new
that matches aJLabelMatcher
by its text.JLabel
static JLabelMatcher
Creates a new
that matches aJLabelMatcher
by its text.JLabel
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
-
JLabelMatcher
-
-
Method Details
-
withName
Creates a new
that matches aJLabelMatcher
that: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:JLabel
JLabelMatcher 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:JLabel
JLabelMatcher m =
withName
("firstName").andText
("First Name:").andShowing
();- Parameters:
name
- the id to match.- Returns:
- the created matcher.
-
withText
Creates a new
that matches aJLabelMatcher
by its text.JLabel
The following code listing shows how to match a
by text:JLabel
JLabelMatcher m =
withText
("First Name:");The following code listing shows how to match a
, that should be showing on the screen, by text:JLabel
JLabelMatcher m =
withText
("First Name:").andShowing
();- Parameters:
text
- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
withText
Creates a new
that matches aJLabelMatcher
by its text.JLabel
The following code listing shows how to match a
by text:JLabel
JLabelMatcher m =
withText
(Pattern.compile("F.*");The following code listing shows how to match a
, that should be showing on the screen, by text:JLabel
JLabelMatcher m =
withText
(Pattern.compile("F.*").andShowing
();- Parameters:
textPattern
- the regular expression pattern to match.- Returns:
- the created matcher.
- Since:
- 1.2
-
any
Creates a new
that matches anyJLabelMatcher
.JLabel
- 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.JLabel
- Returns:
- this matcher.
-
isMatching
Indicates whether the text of the given
is equal to the text in this matcher.JLabel
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<JLabel>
- Parameters:
button
- theJLabel
to match.- Returns:
true
if the text in theJLabel
is equal to the text in this matcher,false
otherwise.
-
toString
-