MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getMenu

Method getMenu

src/org/opensourcephysics/display/OSPFrame.java:488–503  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 6

removeMenuItemMethod · 0.95
customizeMethod · 0.95
removeMenuMethod · 0.45
enableMenubarsMethod · 0.45
getMenuItemMethod · 0.45
removeMenuItemMethod · 0.45

Calls 3

equalsMethod · 0.65
getTextMethod · 0.65
trimMethod · 0.45

Tested by

no test coverage detected