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

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