/* * 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 controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import model.Transmitter; import view.ChatView; /** * * @author Apollo */ public class SendController implements ActionListener { ChatView view; Transmitter model; String input; public SendController(ChatView view,Transmitter model) { this.view = view; this.model = model; } public void registerEvents() { view.getInputField().addActionListener(this); } @Override public void actionPerformed(ActionEvent arg0) { input = view.getInputField().getText(); view.getChatanzeige().append(input + "\n"); view.getInputField().setText(""); model.send(input); } }