public class JPopupMenuFixture extends AbstractJComponentFixture<JPopupMenuFixture,JPopupMenu,JPopupMenuDriver>
JPopupMenu
sBACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY
Constructor and Description |
---|
JPopupMenuFixture(Robot robot,
JPopupMenu target)
Creates a new
JPopupMenuFixture . |
Modifier and Type | Method and Description |
---|---|
protected JPopupMenuDriver |
createDriver(Robot robot) |
JMenuItemFixture |
menuItem(GenericTypeMatcher<? extends JMenuItem> matcher)
Finds a
JMenuItem , contained in this fixture's JPopupMenu , that matches the specified search
criteria. |
JMenuItemFixture |
menuItem(String name)
Finds a
JMenuItem , contained in this fixture's JPopupMenu , which name matches the specified one. |
JMenuItemFixture |
menuItemWithPath(String... path)
Finds a
JMenuItem in this fixture's JPopupMenu , which path matches the given one. |
String[] |
menuLabels() |
clientProperty, requireToolTip, requireToolTip
background, click, click, click, doubleClick, driver, drop, equals, focus, font, foreground, hashCode, isEnabled, myself, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, releaseKey, replaceDriverWith, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireShowing, requireVisible, rightClick, robot, target, targetCastedTo
public JPopupMenuFixture(@Nonnull Robot robot, @Nonnull JPopupMenu target)
JPopupMenuFixture
.robot
- performs simulation of user events on the given JPopupMenu
.target
- the JPopupMenu
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.@Nonnull protected JPopupMenuDriver createDriver(@Nonnull Robot robot)
createDriver
in class AbstractComponentFixture<JPopupMenuFixture,JPopupMenu,JPopupMenuDriver>
@Nonnull public JMenuItemFixture menuItem(@Nullable String name)
JMenuItem
, contained in this fixture's JPopupMenu
, which name matches the specified one.name
- the name to match.JMenuItem
found.ComponentLookupException
- if a JMenuItem
having a matching name could
not be found.ComponentLookupException
- if more than one JMenuItem
having a matching
name is found.@Nonnull public JMenuItemFixture menuItem(@Nonnull GenericTypeMatcher<? extends JMenuItem> matcher)
JMenuItem
, contained in this fixture's JPopupMenu
, that matches the specified search
criteria.matcher
- contains the search criteria for finding a JMenuItem
.JMenuItem
found.ComponentLookupException
- if a JMenuItem
that matches the given search
criteria could not be found.ComponentLookupException
- if more than one JMenuItem
that matches the
given search criteria is
found.@Nonnull public JMenuItemFixture menuItemWithPath(@Nonnull String... path)
Finds a JMenuItem
in this fixture's JPopupMenu
, which path matches the given one.
For example, if we are looking for the menu with text "New" contained under the menu with text "File", we can simply call
JPopupMenuFixture popupMenu = tree.showPopupMenu(); JMenuItemFixture menuItem = popupMenu.menuItemWithPath("File", "Menu");
path
- the path of the menu to find.JMenuItem
found.ComponentLookupException
- if a JMenuItem
under the given path could not
be found.AssertionError
- if the Component
found under the given path is not a JMenuItem
.Copyright © 2014–2019 AssertJ. All rights reserved.