- /**
- * Adds a menu item with the given command to the given popup menu.
- */
- private JMenuItem addMenuItem(JPopupMenu menu, String command) {
- JMenuItem item = new JMenuItem(command);
- item.addActionListener(new PopupListener());
- menu.add(item);
- return item;
- }
-
- /**
- * Adds a menu item with the given command to the given menu.
- */
- private JMenuItem addMenuItem(JMenu menu, String command) {
- JMenuItem item = new JMenuItem(command);
- item.addActionListener(new PopupListener());
- menu.add(item);
- return item;
- }
-
- /**
- * Creates a transpose sub menu with the given title in the given popup menu,
- * inserting the items into the given array.
- */
- private JMenu createTransposeMenu(JPopupMenu menu, JMenuItem[] items, String title) {
- JMenu trans = new JMenu("Transpose " + title);
- menu.add(trans);
- items[0] = addMenuItem(trans, "One octave");
- for (int i = 1; i < 12; i++) {
- items[i] = addMenuItem(trans, (i) + " halftones");
- }
- return trans;
- }
-