Properties settings = new Properties();
InputStream in;
try {
// Create the file if it doesn't exist
File f = new File("settings.xml");
if (f.createNewFile()) {
// Default settings please?
new SettingsWindow(this);
}
// Try reading it
in = new BufferedInputStream(new FileInputStream("settings.xml"));
}
catch (IOException e) {
// Didn't work creating and/or reading? Die ...
JOptionPane.showMessageDialog(null,"Settings file not found","Error",JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
settings.loadFromXML(in);