send versucht zu implementieren

This commit is contained in:
ahren
2023-12-13 13:04:21 +01:00
parent efecd40ab4
commit e617b11f86
10 changed files with 133 additions and 76 deletions
@@ -10,6 +10,7 @@ import ChatProgramm.model.Server;
import ChatProgramm.util.OhmLogger;
import ChatProgramm.view.ChatView;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JRadioButton;
@@ -24,16 +25,18 @@ public class CommandConnect implements CommandInterface
private JRadioButton rBtnClient;
private JDialog dialogFenster;
private static Logger lg = OhmLogger.getLogger();
private final Client client;
private final Server server;
private CommandSend commandSend;
private ChatView view;
public CommandConnect(ChatView view, Server server, Client client)
public CommandConnect(ChatView view, CommandInterface value)
{
rBtnServer = view.getBtnServer();
rBtnClient = view.getBtnClient();
dialogFenster = view.getjDialog1();
this.client = client;
this.server = server;
commandSend = (CommandSend) value;
this.view = view;
}
@Override
@@ -42,7 +45,7 @@ public class CommandConnect implements CommandInterface
if(rBtnServer.isSelected()){
lg.info("Server ausgewählt");
try {
server.connect();
commandSend.transmitterInterface = new Server(view);
} catch (IOException ex) {
lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
}
@@ -51,7 +54,7 @@ public class CommandConnect implements CommandInterface
if(rBtnClient.isSelected()){
lg.info("Client ausgewählt");
try {
client.connect();
commandSend.transmitterInterface = new Client(view);
} catch (IOException ex) {
lg.info("Die Verbindung zum Client ist Fehlgeschlagen");
@@ -71,4 +74,4 @@ public class CommandConnect implements CommandInterface
public void undo()
{
}
}
}