Gets a menu with the given name from the menu bar. Returns null if menu item does not exist. @param menuName String @return JMenu
(String menuName)
| 486 | * @return JMenu |
| 487 | */ |
| 488 | public JMenu getMenu(String menuName) { |
| 489 | JMenuBar menuBar = getJMenuBar(); |
| 490 | if (menuBar == null) { |
| 491 | return null; |
| 492 | } |
| 493 | menuName = menuName.trim(); |
| 494 | JMenu menu = null; |
| 495 | for (int i = 0; i < menuBar.getMenuCount(); i++) { |
| 496 | JMenu next = menuBar.getMenu(i); |
| 497 | if (next.getText().trim().equals(menuName)) { |
| 498 | menu = next; |
| 499 | break; |
| 500 | } |
| 501 | } |
| 502 | return menu; |
| 503 | } |
| 504 | |
| 505 | /** |
| 506 | * Removes a menu with the given name from the menu bar and returns the removed |
no test coverage detected