+ /**
+ * Adds an item for this file to the top of the reopen menu.
+ */
+ private void addReopenItem(String file) {
+ for (int i = 0; i < reopen.getMenuComponentCount(); i++) {
+ if (file.equals(((JMenuItem)reopen.getMenuComponent(i)).getText()))
+ reopen.remove(i);
+ }
+ JMenuItem recentFile = new JMenuItem(file);
+ recentFile.addActionListener(this);
+ reopen.insert(recentFile, 0);
+ if (reopen.getMenuComponentCount() > 5) reopen.remove(5);
+ }
+
+ /**
+ * Checks if the given file has the extension ".mid".
+ */