Browse Source

Server/Client verbindung durch rBtn

Jens
Jens Schuhmann 1 year ago
parent
commit
0853e26034

+ 1
- 1
src/ChatProgramm/controller/CommandController.java View File

@@ -36,7 +36,7 @@ public class CommandController implements ActionListener{
}
public void registerCommands(){
invoker.addCommand(view.getBtnConnect(), new CommandConnect());
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view));
invoker.addCommand(view.getTfNachricht(), new CommandSend());
}


+ 39
- 2
src/ChatProgramm/controller/commands/CommandConnect.java View File

@@ -5,20 +5,57 @@

package ChatProgramm.controller.commands;

import ChatProgramm.Client;
import ChatProgramm.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;

/**
*
* @author ahren
*/
public class CommandConnect implements CommandInterface
{
public CommandConnect()
private JRadioButton rBtnServer;
private JRadioButton rBtnClient;
private JDialog dialogFenster;
private static Logger lg = OhmLogger.getLogger();
public CommandConnect(ChatView view)
{
rBtnServer = view.getBtnServer();
rBtnClient = view.getBtnClient();
dialogFenster = view.getjDialog1();
}

@Override
public void execute()
{
if(rBtnServer.isSelected()){
lg.info("Server ausgewählt");
try {
new Server();
} catch (IOException ex) {
lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
}
}
if(rBtnClient.isSelected()){
lg.info("Client ausgewählt");
try {
new Client();
} catch (IOException ex) {
lg.info("Die Verbindung zum Client ist Fehlgeschlagen");

}
}
dialogFenster.setVisible(false);
}

@Override

Loading…
Cancel
Save