Main.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package ui.view;
  2. import ui.controller.Control;
  3. import ui.controller.SingletonControl;
  4. import ui.model.Model;
  5. import javax.swing.*;
  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. // *Design
  23. try {
  24. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  25. } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  26. e.printStackTrace();
  27. }
  28. else
  29. try {
  30. UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
  31. } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
  32. | UnsupportedLookAndFeelException e) {
  33. e.printStackTrace();
  34. }
  35. EventQueue.invokeLater(() -> {
  36. try {
  37. Model model = new Model();
  38. Control control = new Control(model);
  39. SingletonControl.getInstance().setControl(control);
  40. GUI view = new GUI(control);
  41. view.getFrmCyberPhysical().setVisible(true);
  42. } catch (Exception e) {
  43. e.printStackTrace();
  44. }
  45. });
  46. }
  47. }