Main.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package ui.view.main;
  2. import ui.controller.Control;
  3. import ui.controller.IndexTranslator;
  4. import ui.model.Model;
  5. import javax.swing.*;
  6. import java.awt.*;
  7. import java.util.Locale;
  8. /**
  9. * The main Class in this Program. The GUI is created in this Class.
  10. *
  11. * @author Gruppe14
  12. *
  13. */
  14. public class Main {
  15. /**
  16. * main method of this program.
  17. *
  18. * @param args standard
  19. */
  20. public static void main(String[] args) {
  21. setLookAndFeel();
  22. setLocale();
  23. EventQueue.invokeLater(() -> {
  24. Model model = new Model();
  25. Control control = new Control(model);
  26. GUI view = new GUI(control);
  27. IndexTranslator.model = model;
  28. view.setVisible(true);
  29. });
  30. }
  31. private static void setLocale() {
  32. Locale.setDefault(Locale.US);
  33. }
  34. /**
  35. * This method loads the System LookAndFeel. Except for Linux OS.
  36. */
  37. private static void setLookAndFeel() {
  38. try {
  39. if (!System.getProperty("os.name").startsWith("Linux")) {
  40. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  41. }
  42. } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
  43. | UnsupportedLookAndFeelException e) {
  44. }
  45. }
  46. }