package holeg.ui.view.main; import javax.swing.*; import holeg.ui.controller.Control; import holeg.ui.controller.IndexTranslator; import holeg.ui.model.Model; import java.awt.*; import java.io.FileInputStream; import java.io.IOException; import java.util.Locale; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; /** * The main Class in this Program. The GUI is created in this Class. * * @author Gruppe14 */ public class Main { private static final LogManager logManager = LogManager.getLogManager(); private static final Logger log = Logger.getLogger(Main.class.getName()); static { try { logManager.readConfiguration(new FileInputStream("./config/log.properties")); } catch (IOException exception) { log.log(Level.SEVERE, "Error in loading configuration", exception); } } /** * main method of this program. * * @param args standard */ public static void main(String[] args) { setLookAndFeel(); setLocale(); EventQueue.invokeLater(() -> { Model model = new Model(); Control control = new Control(model); GUI view = new GUI(control); IndexTranslator.model = model; view.setVisible(true); }); } private static void setLocale() { Locale.setDefault(Locale.US); } /** * This method loads the System LookAndFeel. Except for Linux OS. */ private static void setLookAndFeel() { try { if (!System.getProperty("os.name").startsWith("Linux")) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { } } }