Main.java 1.2 KB

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