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.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 graphicChat;
  7. import javax.swing.JFrame;
  8. import javax.swing.WindowConstants;
  9. import graphicChat.controller.CommandConnect;
  10. import graphicChat.controller.CommandSend;
  11. import graphicChat.controller.GraphicsController;
  12. import graphicChat.controller.ReceiveAdapter;
  13. import graphicChat.view.ChatView;
  14. import graphicChat.model.ChatModel;
  15. import javax.swing.JOptionPane;
  16. import javax.swing.UIManager;
  17. /**
  18. * Builder Class
  19. * @author le
  20. */
  21. public class Start
  22. {
  23. public Start()
  24. {
  25. JFrame frm = new JFrame();
  26. frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  27. ChatView view = new ChatView();
  28. ChatModel model = new ChatModel();
  29. view.getGrafikView1().setModel(model);
  30. GraphicsController controller = new GraphicsController(view.getGrafikView1(), model);
  31. controller.registerEvents();
  32. CommandConnect cmdConnect = new CommandConnect(view, model);
  33. cmdConnect.registerEvents();
  34. CommandSend cmdSend = new CommandSend(view, model);
  35. cmdSend.registerEvents();
  36. ReceiveAdapter recAdapter = new ReceiveAdapter(view, model);
  37. recAdapter.subscribe();
  38. view.setVisible(true);
  39. view.setTitle("Chat");
  40. view.setSize(800, 600);
  41. view.setVisible(true);
  42. }
  43. /**
  44. * @param args the command line arguments
  45. */
  46. public static void main(String[] args)
  47. {
  48. try
  49. {
  50. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  51. }
  52. catch (Exception ex)
  53. {
  54. JOptionPane.showMessageDialog(null, ex.toString());
  55. }
  56. new Start();
  57. new Start();
  58. }
  59. }