Main.java 1.2 KB

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