public NewPlayerMatcher implements Matcher { public boolean matches(Component c) { return c instanceof JMenuItem && "New Player".equals(((JMenuItem) c).getText()); } }