ist mal n Anfang

wenn du das Programm über Start.java startest, erscheint die View + 
Dialog zum Auswählen, es passiert aber noch nix
This commit is contained in:
ahren
2023-12-11 13:58:53 +01:00
parent f431fc9147
commit 4a7f17b1dc
18 changed files with 900 additions and 73 deletions
@@ -0,0 +1,58 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package ChatProgramm.controller;
import ChatProgramm.controller.commands.CommandConnect;
import ChatProgramm.controller.commands.CommandInvoker;
import ChatProgramm.controller.commands.CommandSend;
import ChatProgramm.model.Transmitter;
import ChatProgramm.view.ChatView;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
*
* @author ahren
*/
public class CommandController implements ActionListener{
private ChatView view;
private Transmitter transmitter;
private CommandInvoker invoker;
public CommandController(ChatView view, Transmitter transmitter){
this.view = view;
this.transmitter = transmitter;
this.invoker = new CommandInvoker();
}
public void registerEvents(){
view.getBtnConnect().addActionListener(this);
view.getTfNachricht().addActionListener(this);
}
public void registerCommands(){
invoker.addCommand(view.getBtnConnect(), new CommandConnect());
invoker.addCommand(view.getTfNachricht(), new CommandSend());
}
/**
* Ausführen des jeweiligen Kommandos
* @param e Referenz auf das Event
*/
@Override
public void actionPerformed(ActionEvent e) {
Component key = (Component)e.getSource();
invoker.executeCommand(key);
// if(key == view.getBtnOpen()|| key==view.getMiOpen())
// invoker.deleteStack();
// }
}
}