public synchronized static void dealWith (final Throwable t) {

		// First, print the stack trace

		t.printStackTrace();


		// Second, write the exception to a log file

		String osName = System.getProperty ("os.name");
		String userHome = System.getProperty ("user.home");
		String propertiesDirectory;

		if (osName.startsWith ("Windows")) {
			String applicationDataName = System.getenv ("APPDATA");
			if (applicationDataName == null) {
				applicationDataName = "Application Data";
			}
			propertiesDirectory = userHome + File.separator + applicationDataName + File.separator + "Itadaki";
		} else {
			propertiesDirectory = userHome + File.separator + ".itadaki";
		}

		File propertiesDirectoryFile = new File (propertiesDirectory);
		if (!propertiesDirectoryFile.exists()) {
			propertiesDirectoryFile.mkdirs();
		}

		String logFilename = propertiesDirectory  + File.separator + "itadaki.log";
		FileWriter fileWriter = null;
		try {
			fileWriter = new FileWriter (new File (logFilename), true);
			PrintWriter printWriter = new PrintWriter (fileWriter);
			printWriter.println ("Exception caught at " + DateFormat.getDateTimeInstance().format (new Date()));
			t.printStackTrace (printWriter);
			printWriter.println();
			printWriter.println();
		} catch (IOException e) {
			// Not much to do about it really
		} finally {
			try {
				if (fileWriter != null) {
					fileWriter.close();
				}
			} catch (IOException e) {
				// Ignore
			}
		}
		

		// Finally, attempt to show an explanatory dialog

		SwingUtilities.invokeLater (new Runnable() {

			/* (non-Javadoc)
			 * @see java.lang.Runnable#run()
			 */
			public void run() {

				if (exceptionDialog == null) {
					createDialog();
				}

				if (!exceptionDialog.isVisible()) {
					stackTraceTextArea.setText("");
				}

				Writer stringWriter = new StringWriter();
				t.printStackTrace (new PrintWriter (stringWriter));
				stackTraceTextArea.append (stringWriter.toString());
				stackTraceTextArea.append ("\n\n");

				exceptionDialog.setVisible (true);

			}
			
		});

	}