Main.java 1.3 KB

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