Main.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. // try {
  40. // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
  41. // } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
  42. // | UnsupportedLookAndFeelException e) {
  43. // e.printStackTrace();
  44. // }
  45. }else {
  46. loadNotLinuxLookAndFeel();
  47. }
  48. EventQueue.invokeLater(() -> {
  49. try {
  50. Model model = new Model();
  51. Control control = new Control(model);
  52. SingletonControl.getInstance().setControl(control);
  53. GUI view = new GUI(control);
  54. view.getFrmCyberPhysical().setVisible(true);
  55. } catch (Exception e) {
  56. e.printStackTrace();
  57. }
  58. });
  59. }
  60. private static void loadNotLinuxLookAndFeel() {
  61. try {
  62. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  63. } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  64. e.printStackTrace();
  65. }
  66. }
  67. }