From 1aa5b51e78497242f3b444df40555ca1083fdfd1 Mon Sep 17 00:00:00 2001 From: schuhmannje82308 Date: Mon, 18 Dec 2023 14:00:26 +0100 Subject: [PATCH] Versuch SendCommand mit invoker zu implementieren --- src/ChatProgramm/Start.java | 7 +++++-- src/ChatProgramm/controller/GrafikController.java | 9 +++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ChatProgramm/Start.java b/src/ChatProgramm/Start.java index 2980a17..94d5837 100644 --- a/src/ChatProgramm/Start.java +++ b/src/ChatProgramm/Start.java @@ -25,11 +25,14 @@ public class Start ChatView view = new ChatView(); GrafikView zeichenflaeche = view.getGvZeichenflaeche(); zeichenflaeche.setModel(model); - GrafikController controller = new GrafikController(zeichenflaeche, model); - controller.registerEvents(); + CommandController controller_commands = new CommandController(view); controller_commands.registerEvents(); controller_commands.registerCommands(); + + GrafikController controller = new GrafikController(zeichenflaeche, model, controller_commands); + controller.registerEvents(); + view.setVisible(true); } diff --git a/src/ChatProgramm/controller/GrafikController.java b/src/ChatProgramm/controller/GrafikController.java index fe13b4a..7318891 100644 --- a/src/ChatProgramm/controller/GrafikController.java +++ b/src/ChatProgramm/controller/GrafikController.java @@ -24,9 +24,9 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene { private GrafikView view; private GrafikModel model; - private CommandInvoker invoker; + private CommandControler commandController; - public GrafikController(GrafikView view, GrafikModel model) + public GrafikController(GrafikView view, GrafikModel model, CommandController controller_commands) { this.view = view; this.model = model; @@ -37,10 +37,7 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene view.addMouseMotionListener(this); view.addMouseListener(this); } - public void registerCommands(){ - CommandSend commandSend = new CommandSend(view); - invoker.addCommand(view.getTfNachricht(), commandSend); - } + @Override