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

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