public void load(String file) 
    {
        // when we load a new file, stop playback of other file.
        stop();
        
        // Don't try all this if the sequencer is not open.
        if ( !sequencer.isOpen() ) {
            System.err.println("Cannot load a midiFile. The sequencer is not open.");
            return;
        }
        
        try {
            
            // Open a midi file
            // Get the midi file as a URL
            URL url =  getClass().getClassLoader().getResource("" + file);
           
            // Get a midi sequence from the midi system and url
            Sequence sequence = MidiSystem.getSequence(url);
            
            // Now set this midi file to the sequencer
            sequencer.setSequence(sequence);
        
            // Now set isFileOpen to true, since we successfully opened it.
            isFileOpen = true;
            // Also, set the midiFile variable
            midiFile = file;
        
            // Print a success message to the console
            System.out.println("Loaded " + midiFile + ".");
        
        } catch ( IOException e) {
            System.err.println("IO Exception opening midi file: " + midiFile);
            System.err.println(e);
            isFileOpen = false;
        } catch ( InvalidMidiDataException e) {
            System.err.println("Invalid Midi Data");
            System.err.println(e);
            isFileOpen = false;
        }
    } // End load()