public void updateMidiInSelectedItems(String[] midiInDevices) {
        for (int i = 0; i < midiInMenu.getItemCount(); i++) {
            String name = midiInMenu.getItem(i).getText();
            if (name == null || name.equals("No MIDI Input Devices Enabled")) {
                continue;
            }
            String[] pieces = name.split("MIDI Input: ");
            boolean found = false;
            for (int j = 0; j < midiInDevices.length; j++) {
                if (midiInDevices[j] == null) {
                    continue;
                }
                if (pieces[1].compareTo(midiInDevices[j]) == 0) {
                    midiInMenu.getItem(i).setSelected(true);
                    found = true;
                }
            }
            if (!found) {
                midiInMenu.getItem(i).setSelected(false);
            }
        }
    }