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

Method removeMenu

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

Removes a menu with the given name from the menu bar and returns the removed item. Returns null if menu item does not exist. @param menuName String @return JMenu

(String menuName)

Source from the content-addressed store, hash-verified

510 * @return JMenu
511 */
512 public JMenu removeMenu(String menuName) {
513 JMenuBar menuBar = getJMenuBar();
514 if (menuBar == null) {
515 return null;
516 }
517 menuName = menuName.trim();
518 JMenu menu = null;
519 for (int i = 0; i < menuBar.getMenuCount(); i++) {
520 JMenu next = menuBar.getMenu(i);
521 if (next.getText().trim().equals(menuName)) {
522 menu = next;
523 menuBar.remove(i);
524 break;
525 }
526 }
527 return menu;
528 }
529
530 /**
531 * Removes a menu item with the given name from the menu bar and returns the

Callers 10

addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80
addMenuItemsMethod · 0.80

Calls 5

equalsMethod · 0.65
getTextMethod · 0.65
removeMethod · 0.65
trimMethod · 0.45
getMenuMethod · 0.45

Tested by

no test coverage detected