Index: trunk/src/org/apollo/meldex/PitchTracker.java
===================================================================
--- trunk/src/org/apollo/meldex/PitchTracker.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/PitchTracker.java	(revision 1102)
@@ -3,5 +3,4 @@
 import java.util.ArrayList;
 
-@SuppressWarnings("unchecked") // code in java 1.4
 public class PitchTracker
 {
@@ -14,5 +13,5 @@
 
     // The pitch data
-    ArrayList pitchData;
+    ArrayList<PitchValue> pitchData;
 
     // Our lovely Pitch Period Estimators
@@ -26,5 +25,5 @@
 
 
-    public ArrayList process(byte[] rawData, int rawLength, int rawSampleRate)
+    public ArrayList<PitchValue> process(byte[] rawData, int rawLength, int rawSampleRate)
     {
 	// Save the sample rate of the loaded sample
@@ -32,5 +31,5 @@
 
 	// Allocate a new pitch data array to store our pitch values
-	pitchData = new ArrayList();
+	pitchData = new ArrayList<PitchValue>();
 
 	// Reset our 6 pitch period estimators
Index: trunk/src/org/apollo/meldex/PitchValue.java
===================================================================
--- trunk/src/org/apollo/meldex/PitchValue.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/PitchValue.java	(revision 1102)
@@ -11,6 +11,6 @@
     public PitchValue(double per, int pos)
     {
-	period = per;
-	position = pos;
+		period = per;
+		position = pos;
     }
 }
Index: trunk/src/org/apollo/meldex/RogTrack.java
===================================================================
--- trunk/src/org/apollo/meldex/RogTrack.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/RogTrack.java	(revision 1102)
@@ -1,12 +1,12 @@
 package org.apollo.meldex;
-
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
-import javax.swing.JOptionPane;
-
-@SuppressWarnings("unchecked") // code in java 1.4
+
+import org.expeditee.gio.EcosystemManager;
+
 public class RogTrack
 {
@@ -20,5 +20,5 @@
 
     // Data representing the track events
-    ArrayList trackData = new ArrayList();
+    ArrayList<RogTrackEvent> trackData = new ArrayList<RogTrackEvent>();
 
 
@@ -217,5 +217,5 @@
 	int track_len = trackData.size();
 
-	ArrayList filtered_td = new ArrayList();
+	ArrayList<RogTrackEvent> filtered_td = new ArrayList<RogTrackEvent>();
 
 	for (int i = 0; i < track_len; i++) {
@@ -235,5 +235,5 @@
 	}
 
-	ArrayList me_list = new ArrayList();
+	ArrayList<MelodyEvent> me_list = new ArrayList<MelodyEvent>();
 
 	for (int i = 0; i < filtered_track_len-1; i++) {
@@ -283,25 +283,34 @@
     public boolean loadFromFile(File rogFile)
     {
-	try {
-	    // Open the file with a FileInputStream, ready for parsing
-	    FileInputStream fileIn = new FileInputStream(rogFile);
-
-	    // Get the number of bytes in the file
-	    int rogLength = fileIn.available();
-
-	    // Create a buffer to store the file, and read the file into it
-	    byte[] rogData = new byte[rogLength];
-	    fileIn.read(rogData, 0, rogLength);
-
-	    // Parse the .rog file
-	    parseFile(rogData, rogLength);
-	}
-	catch (Exception ex) {
-	    JOptionPane.showMessageDialog(null, "Exception occurred reading file.\n\n" + ex);
-	    return false;
-	}
-
-	// File loaded successfully
-	return true;
+    	boolean success = true;
+    	FileInputStream fileIn = null;
+		try {
+		    // Open the file with a FileInputStream, ready for parsing
+		    fileIn = new FileInputStream(rogFile);
+	
+		    // Get the number of bytes in the file
+		    int rogLength = fileIn.available();
+	
+		    // Create a buffer to store the file, and read the file into it
+		    byte[] rogData = new byte[rogLength];
+		    fileIn.read(rogData, 0, rogLength);
+	
+		    // Parse the .rog file
+		    parseFile(rogData, rogLength);
+		} catch (Exception ex) {
+			EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred reading file.\n\n" + ex);
+			success = false;
+		} finally {
+			if (fileIn != null) {
+				try {
+					fileIn.close();
+				} catch (IOException e) {
+					// If an IO exception occurs when closing the file, just sweep it under the rug
+				}
+			}
+		}
+	
+		// File loaded successfully
+		return success;
     }
 
@@ -406,5 +415,5 @@
 	    // Check that the noteName is valid
 	    if (noteName < 'A' || noteName > 'G') {
-		JOptionPane.showMessageDialog(null, "Parsing error - check that the Rog file is valid.");
+		EcosystemManager.getGraphicsManager().showDialog("Exception", "Parsing error - check that the Rog file is valid.");
 		return;
 	    }
@@ -497,5 +506,5 @@
 	}
 	catch (Exception ex) {
-	    JOptionPane.showMessageDialog(null, "Exception occurred writing to file.\n\n" + ex);
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred writing to file.\n\n" + ex);
 	    return false;
 	}
Index: trunk/src/org/apollo/meldex/StandardisedMelody.java
===================================================================
--- trunk/src/org/apollo/meldex/StandardisedMelody.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/StandardisedMelody.java	(revision 1102)
@@ -93,5 +93,9 @@
 
 	    // Read the melody from the melody file
-	    return (StandardisedMelody) melodyFileStream.readObject();
+	    StandardisedMelody standardisedMelody = (StandardisedMelody) melodyFileStream.readObject();
+	    
+	    melodyFileStream.close();
+	    
+	    return standardisedMelody;
 
     }
Index: trunk/src/org/apollo/meldex/Transcriber.java
===================================================================
--- trunk/src/org/apollo/meldex/Transcriber.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/Transcriber.java	(revision 1102)
@@ -4,5 +4,4 @@
 import java.util.ArrayList;
 
-@SuppressWarnings("unchecked") // code in java 1.4
 public class Transcriber
 {
@@ -255,5 +254,5 @@
     {
 	// Pitch track the note
-	ArrayList pitchData = pitchTracker.process(data, length, sampleRate);
+	ArrayList<PitchValue> pitchData = pitchTracker.process(data, length, sampleRate);
 
 	// Average the pitch data
@@ -265,13 +264,13 @@
 
 
-    private int averagePitchData(ArrayList pitchData)
+    private int averagePitchData(ArrayList<PitchValue> pitchData)
     {
 	// Loop through the pitch values...
 	int i = 0, k = 0;
 	while (i < (pitchData.size() - 1)) {
-	    int startPos = ((PitchValue) pitchData.get(i)).position;
-	    double period = ((PitchValue) pitchData.get(i)).period;
+	    int startPos = pitchData.get(i).position;
+	    double period = pitchData.get(i).period;
 	    double averagePeriod = period;
-	    double runningPeriod = ((PitchValue) pitchData.get(i+1)).position - startPos;
+	    double runningPeriod = pitchData.get(i+1).position - startPos;
 	    double numPeriods = runningPeriod / period;
 
@@ -280,6 +279,6 @@
 	    while ((i+j) < (pitchData.size() - 1)) {
 		// Get the next pitch estimate
-		period = ((PitchValue) pitchData.get(i+j)).period;
-		int position = ((PitchValue) pitchData.get(i+j)).position;
+		period = pitchData.get(i+j).period;
+		int position = pitchData.get(i+j).position;
 
 		// Make sure that this period is covered by the average so far
@@ -289,5 +288,5 @@
 
 		// Stop if we have covered more than 20 msec
-		int nextPos = ((PitchValue) pitchData.get(i+j+1)).position;
+		int nextPos = pitchData.get(i+j+1).position;
 		// if ((nextPos - startPos) >= 445) {  // !! PURE-ROG !!
 		if ((nextPos - startPos) >= (sampleRate * 0.02)) {
@@ -315,5 +314,5 @@
 
 
-    private int calculateHistogram(ArrayList data, int length)
+    private int calculateHistogram(ArrayList<PitchValue> data, int length)
     {
 	// This probably shouldn't be a constant
@@ -328,7 +327,7 @@
 	// Calculate the histogram data
 	for (int i = 0; i < (length - 1); i++) {
-	    double period = ((PitchValue) data.get(i)).period;
-	    double position = ((PitchValue) data.get(i)).position;
-	    double periodLength = ((PitchValue) data.get(i+1)).position - position;
+	    double period = data.get(i).period;
+	    double position = data.get(i).position;
+	    double periodLength = data.get(i+1).position - position;
 
 	    // We only need to do this if the pitch does not equal zero
Index: trunk/src/org/apollo/meldex/WavSample.java
===================================================================
--- trunk/src/org/apollo/meldex/WavSample.java	(revision 1006)
+++ trunk/src/org/apollo/meldex/WavSample.java	(revision 1102)
@@ -8,7 +8,7 @@
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
-import javax.swing.JOptionPane;
-
-@SuppressWarnings("unchecked") // code in java 1.4
+
+import org.expeditee.gio.EcosystemManager;
+
 public class WavSample
 {
@@ -68,5 +68,5 @@
 	}
 	catch (Exception ex) {
-	    JOptionPane.showMessageDialog(null, "Exception occurred creating sample.\n\n" + ex);
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred creating sample.\n\n" + ex);
 	    return false;
 	}
@@ -90,5 +90,5 @@
 	    }
 	    catch (Exception ex) {
-		JOptionPane.showMessageDialog(null, "Exception occurred reloading sample.\n\n" + ex);
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred reloading sample.\n\n" + ex);
 		return false;
 	    }
@@ -101,5 +101,5 @@
 	    }
 	    catch (Exception ex) {
-		JOptionPane.showMessageDialog(null, "Exception occurred resetting audio stream.\n\n" + ex);
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred resetting audio stream.\n\n" + ex);
 		return false;
 	    }
@@ -172,5 +172,5 @@
 	if (format.getSampleSizeInBits() == 8) {
 	    if (format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)) {
-		JOptionPane.showMessageDialog(null, "Oops! Internal Error: Unexpected audio format (signed 8-bit).");
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Oops! Internal Error: Unexpected audio format (signed 8-bit).");
 		return null;
 	    }
@@ -178,5 +178,5 @@
 	if (format.getSampleSizeInBits() == 16) {
 	    if (format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) {
-		JOptionPane.showMessageDialog(null, "Oops! Internal Error: Unexpected audio format (unsigned 16-bit).");
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Oops! Internal Error: Unexpected audio format (unsigned 16-bit).");
 		return null;
 	    }
@@ -188,5 +188,5 @@
 
 	// Create a new list to store the standardised sample values
-	ArrayList stdTemp = new ArrayList();
+	ArrayList<Integer> stdTemp = new ArrayList<Integer>();
 
 	// Simply pick values from the sample at the frequency specified
@@ -218,36 +218,36 @@
 
 
-    private static ArrayList toStandardEndian(AudioFormat format, ArrayList inData)
-    {
-	// Endian details do not apply to 8-bit samples, so no conversion needed
-	if (format.getSampleSizeInBits() == 8) {
-	    return inData;
-	}
-
-	// Create a new list to store the results
-	ArrayList outData = new ArrayList();
-
-	// Simply convert each number in the sample to the endian form for the current system
-	for (int i = 0; i < inData.size(); i += 2) {
-
-	    int MSB, LSB;
-	    if (format.isBigEndian()) {
-		MSB = ((Integer) inData.get(i)).intValue();    // First byte is MSB (high order)
-		LSB = ((Integer) inData.get(i+1)).intValue();  // Second byte is LSB (low order)
-	    }
-	    else {
-		LSB = ((Integer) inData.get(i)).intValue();    // First byte is LSB (low order)
-		MSB = ((Integer) inData.get(i+1)).intValue();  // Second byte is MSB (high order)
-	    }
-
-	    int val = (MSB << 8) + (LSB & 255);
-	    outData.add(new Integer(val));
-	}
-
-	return outData;
-    }
-
-
-    private static ArrayList toUnsignedValues(AudioFormat format, ArrayList inData)
+    private static ArrayList<Integer> toStandardEndian(AudioFormat format, ArrayList<Integer> inData)
+    {
+		// Endian details do not apply to 8-bit samples, so no conversion needed
+		if (format.getSampleSizeInBits() == 8) {
+		    return inData;
+		}
+	
+		// Create a new list to store the results
+		ArrayList<Integer> outData = new ArrayList<Integer>();
+	
+		// Simply convert each number in the sample to the endian form for the current system
+		for (int i = 0; i < inData.size(); i += 2) {
+	
+		    int MSB, LSB;
+		    if (format.isBigEndian()) {
+			MSB = ((Integer) inData.get(i)).intValue();    // First byte is MSB (high order)
+			LSB = ((Integer) inData.get(i+1)).intValue();  // Second byte is LSB (low order)
+		    }
+		    else {
+			LSB = ((Integer) inData.get(i)).intValue();    // First byte is LSB (low order)
+			MSB = ((Integer) inData.get(i+1)).intValue();  // Second byte is MSB (high order)
+		    }
+	
+		    int val = (MSB << 8) + (LSB & 255);
+		    outData.add(new Integer(val));
+		}
+	
+		return outData;
+    }
+
+
+    private static ArrayList<Integer> toUnsignedValues(AudioFormat format, ArrayList<Integer> inData)
     {
 	// PCM_UNSIGNED samples are what we want, so no conversion needed
@@ -257,5 +257,5 @@
 
 	// Create a new list to store the results
-	ArrayList outData = new ArrayList();
+	ArrayList<Integer> outData = new ArrayList<Integer>();
 
 	// Simply convert each signed number in the sample to an unsigned value
@@ -275,5 +275,5 @@
 
 
-    private static ArrayList to8bit(AudioFormat format, ArrayList inData)
+    private static ArrayList<Integer> to8bit(AudioFormat format, ArrayList<Integer> inData)
     {
 	// 8-bit data is what we want, so no conversion necessary
@@ -283,5 +283,5 @@
 
 	// Create a new list to store the results
-	ArrayList outData = new ArrayList();
+	ArrayList<Integer> outData = new ArrayList<Integer>();
 
 	// Simply reduce each value in the sample to an 8-bit value
@@ -298,5 +298,5 @@
 
 
-    private static ArrayList toMono(AudioFormat format, ArrayList inData)
+    private static ArrayList<Integer> toMono(AudioFormat format, ArrayList<Integer> inData)
     {
 	// Mono-channel data is what we want, so no conversion necessary
@@ -306,5 +306,5 @@
 
 	// Create a new list to store the results
-	ArrayList outData = new ArrayList();
+	ArrayList<Integer> outData = new ArrayList<Integer>();
 
 	// Simply average all of the channels for each frame
@@ -362,10 +362,10 @@
 	try {
 	    if (AudioSystem.write(audioData, AudioFileFormat.Type.WAVE, outFile) == -1) {
-		JOptionPane.showMessageDialog(null, "Problem occurred writing to file.");
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Problem occurred writing to file.");
 		return false;
 	    }
 	}
 	catch (Exception ex) {
-	    JOptionPane.showMessageDialog(null, "Exception occurred saving file.\n\n" + ex);
+	    EcosystemManager.getGraphicsManager().showDialog("Exception", "Exception occurred saving file.\n\n" + ex);
 	    return false;
 	}
