package totallynotmalware;

import java.io.IOException;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import totallynotmalware.i18n.I18n;
import totallynotmalware.ui.MainWindow;

public class TotallyNotMalware {
	
	public static void main(String[] args) throws Exception {
		try {
			I18n.setLanguage(System.getProperty("user.language"));
		} catch(IOException e) {
			e.printStackTrace();
		}
		
		SwingUtilities.invokeAndWait(new Runnable() {
			public void run() {
				try {
					for(LookAndFeelInfo lf:UIManager.getInstalledLookAndFeels()) {
						String name=lf.getName();
						String cName=lf.getClassName();
						
						// Windows L&F wins if it is available
						if(cName.equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) {
							UIManager.setLookAndFeel(cName);
							break;
						}
						// Use GTK+ L&F if it is available
						if(name.equals("GTK+")) {
							UIManager.setLookAndFeel(cName);
						}
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
				MainWindow window=new MainWindow();
				window.setVisible(true);
			}
		});
	}
}
