Main.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. //System.out.println(System.getProperty("os.name"));
  22. // if (!System.getProperty("os.name").startsWith("Linux")) {
  23. // // *Design
  24. // try {
  25. //
  26. // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  27. // } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  28. // e.printStackTrace();
  29. // }
  30. // }else {
  31. //// try {
  32. //// UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
  33. //// } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
  34. //// | UnsupportedLookAndFeelException e) {
  35. //// e.printStackTrace();
  36. //// }
  37. // }
  38. if (System.getProperty("os.name").startsWith("Linux")) {
  39. }else {
  40. loadNotLinuxLookAndFeel();
  41. }
  42. EventQueue.invokeLater(() -> {
  43. try {
  44. Model model = new Model();
  45. Control control = new Control(model);
  46. SingletonControl.getInstance().setControl(control);
  47. GUI view = new GUI(control);
  48. view.getFrmCyberPhysical().setVisible(true);
  49. } catch (Exception e) {
  50. e.printStackTrace();
  51. }
  52. });
  53. }
  54. private static void loadNotLinuxLookAndFeel() {
  55. try {
  56. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  57. } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  58. e.printStackTrace();
  59. }
  60. }
  61. }