12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /*
- * 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 chatProg.controller;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.logging.Logger;
- import chatProg.logger.OhmLogger;
- import chatProg.model.ChatModel;
- import chatProg.view.ChatView;
-
- /**
- *
- * @author hd, christ
- */
- public class CommandSend implements ActionListener
- {
- private static Logger lg = OhmLogger.getLogger();
- ChatView view;
- ChatModel model;
-
- public CommandSend(ChatView view, ChatModel model)
- {
- this.view = view;
- this.model = model;
- }
-
-
- public void registerEvents(){
- view.getBtnSend().addActionListener(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- Object src = e.getSource();
-
- if(src == view.getBtnSend()){
- String msg = view.getTxtField().getText();
- if(msg != ""){
- model.sendMessage(msg);
- view.getLblStatusDialog().setText("Nachricht gesendet");
- view.getjTextArea().append("Ich: " + msg +"\n");
- }
- view.getTxtField().setText("");
- }
- }
- }
|