Browse Source

Versuch SendCommand mit invoker zu implementieren

Jens
Jens Schuhmann 1 year ago
parent
commit
1aa5b51e78
2 changed files with 8 additions and 8 deletions
  1. 5
    2
      src/ChatProgramm/Start.java
  2. 3
    6
      src/ChatProgramm/controller/GrafikController.java

+ 5
- 2
src/ChatProgramm/Start.java View File

@@ -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);
}


+ 3
- 6
src/ChatProgramm/controller/GrafikController.java View File

@@ -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

Loading…
Cancel
Save