You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Start.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package kommunikation;
  7. import javax.swing.JOptionPane;
  8. import kommunikation.controller.ConnectController;
  9. import kommunikation.controller.GrafikController;
  10. import kommunikation.controller.ReceiveAdapter;
  11. import kommunikation.controller.SendController;
  12. import kommunikation.transmitter.BilderKom;
  13. import kommunikation.view.ViewChat;
  14. /**
  15. * Builder Class
  16. * @author Alexander_Christoph
  17. */
  18. public class Start
  19. {
  20. public Start()
  21. {
  22. Object[] options = {"Client","Server"};
  23. int selected = JOptionPane.showOptionDialog(null,"Wollen Sie Client oder Server sein","Konfiguration",JOptionPane.DEFAULT_OPTION,JOptionPane.QUESTION_MESSAGE,null, options, options[0]);
  24. if(selected < 0)
  25. {
  26. JOptionPane.showMessageDialog(null, "Sie müssen entweder Client oder Server sein. Bitte starten Sie das Programm erneut und wählen eine Option","Fehler", JOptionPane.ERROR_MESSAGE);
  27. }
  28. else
  29. {
  30. ViewChat view = new ViewChat();
  31. BilderKom model = new BilderKom(selected);
  32. model.registerEvents();
  33. if(selected == 1)
  34. {
  35. view.setTitle("Server");
  36. }
  37. view.getGrafikViewChat().setModel(model.getModel());
  38. GrafikController gcontrol= new GrafikController(view.getGrafikViewChat(),model);
  39. gcontrol.registerEvents();
  40. ConnectController control = new ConnectController(view,model);
  41. control.registerEvents();
  42. SendController send = new SendController(view,model);
  43. send.registerEvents();
  44. ReceiveAdapter adapter = new ReceiveAdapter(view,model);
  45. adapter.registerEvents();
  46. view.setVisible(true);
  47. }
  48. }
  49. /**
  50. * @param args the command line arguments
  51. */
  52. public static void main(String[] args)
  53. {
  54. new Start();
  55. }
  56. }