|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* To change this license header, choose License Headers in Project Properties. |
|
|
|
|
|
* To change this template file, choose Tools | Templates |
|
|
|
|
|
* and open the template in the editor. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package graphicChat; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
|
|
|
import javax.swing.WindowConstants; |
|
|
|
|
|
import graphicChat.controller.CommandConnect; |
|
|
|
|
|
import graphicChat.controller.CommandSend; |
|
|
|
|
|
import graphicChat.controller.GraphicsController; |
|
|
|
|
|
import graphicChat.controller.ReceiveAdapter; |
|
|
|
|
|
import graphicChat.view.ChatView; |
|
|
|
|
|
import graphicChat.model.ChatModel; |
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
import javax.swing.UIManager; |
|
|
|
|
|
/** |
|
|
|
|
|
* Builder Class |
|
|
|
|
|
* @author le |
|
|
|
|
|
*/ |
|
|
|
|
|
public class Start |
|
|
|
|
|
{ |
|
|
|
|
|
public Start() |
|
|
|
|
|
{ |
|
|
|
|
|
JFrame frm = new JFrame(); |
|
|
|
|
|
frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
|
|
|
|
|
|
|
|
|
|
|
ChatView view = new ChatView(); |
|
|
|
|
|
ChatModel model = new ChatModel(); |
|
|
|
|
|
view.getGrafikView1().setModel(model); |
|
|
|
|
|
|
|
|
|
|
|
GraphicsController controller = new GraphicsController(view.getGrafikView1(), model); |
|
|
|
|
|
controller.registerEvents(); |
|
|
|
|
|
|
|
|
|
|
|
CommandConnect cmdConnect = new CommandConnect(view, model); |
|
|
|
|
|
cmdConnect.registerEvents(); |
|
|
|
|
|
|
|
|
|
|
|
CommandSend cmdSend = new CommandSend(view, model); |
|
|
|
|
|
cmdSend.registerEvents(); |
|
|
|
|
|
|
|
|
|
|
|
ReceiveAdapter recAdapter = new ReceiveAdapter(view, model); |
|
|
|
|
|
recAdapter.subscribe(); |
|
|
|
|
|
|
|
|
|
|
|
view.setVisible(true); |
|
|
|
|
|
view.setTitle("Chat"); |
|
|
|
|
|
|
|
|
|
|
|
view.setSize(800, 600); |
|
|
|
|
|
view.setVisible(true); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param args the command line arguments |
|
|
|
|
|
*/ |
|
|
|
|
|
public static void main(String[] args) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
JOptionPane.showMessageDialog(null, ex.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
new Start(); |
|
|
|
|
|
new Start(); |
|
|
|
|
|
} |
|
|
|
|
|
} |