Class JButtonMatcher
- All Implemented Interfaces:
ComponentMatcher,ResettableComponentMatcher
JButton by name, text and visibility on the screen.-
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.JButtonSpecifies the text to match.Specifies the text to match.static JButtonMatcherany()Creates a newthat matches anyJButtonMatcher.JButtonprotected booleanisMatching(JButton button) Indicates whether: the name of the givenJButtonis equal to the name in this matcher, and the text of the givenJButtonmatches the text (or pattern) in this matchertoString()static JButtonMatcherCreates a newthat matches aJButtonMatcherthat: has a matching name (optionally) has matching text (optionally) is showing on the screenJButtonstatic JButtonMatcherCreates a newthat matches aJButtonMatcherby its text.JButtonstatic JButtonMatcherCreates a newthat matches aJButtonMatcherby its text.JButtonMethods 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
-
JButtonMatcher
-
-
Method Details
-
withName
Creates a newthat matches aJButtonMatcherthat:JButton- 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:JButtonJButtonMatcher m =
withName("ok").andText("OK");The following code listing shows how to match a
, that should be showing on the screen, by name and text:JButtonJButtonMatcher m =
withName("ok").andText("OK").andShowing();- Parameters:
name- the name to match.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJButtonMatcherby its text.JButtonThe following code listing shows how to match a
by text:JButtonJButtonMatcher m =
withText("OK");The following code listing shows how to match a
, that should be showing on the screen, by text:JButtonJButtonMatcher m =
withText("OK").andShowing();- Parameters:
text- the text to match. It can be a regular expression.- Returns:
- the created matcher.
-
withText
Creates a newthat matches aJButtonMatcherby its text.JButtonThe following code listing shows how to match a
by text, using a regular expression pattern:JButtonJButtonMatcher m =
withText(Pattern.compile("O.*"));The following code listing shows how to match a
, that should be showing on the screen, by text, using a regular expression pattern:JButtonJButtonMatcher m =
withText(Pattern.compile("O.*")).andShowing();- Parameters:
textPattern- the regular expression pattern to match.- Returns:
- the created matcher.
- Since:
- 1.2
-
any
Creates a newthat matches anyJButtonMatcher.JButton- 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.JButton- Returns:
- this matcher.
-
isMatching
Indicates whether:- the name of the given
JButtonis equal to the name in this matcher, and - the text of the given
JButtonmatches the text (or pattern) in this matcher
Note: 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<JButton>- Parameters:
button- theJButtonto match.- Returns:
trueif theJButtonmatches the search criteria in this matcher.
- the name of the given
-
toString
-