1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package holeg.ui.view;
- import javax.swing.*;
- import holeg.ui.controller.Control;
- import holeg.model.Model;
- import holeg.ui.view.main.Gui;
- 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);
- control.loadCategory();
- 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 ignored) {
- }
- }
- }
|