Server/Client verbindung durch rBtn
This commit is contained in:
parent
4a7f17b1dc
commit
0853e26034
@ -36,7 +36,7 @@ public class CommandController implements ActionListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerCommands(){
|
public void registerCommands(){
|
||||||
invoker.addCommand(view.getBtnConnect(), new CommandConnect());
|
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view));
|
||||||
invoker.addCommand(view.getTfNachricht(), new CommandSend());
|
invoker.addCommand(view.getTfNachricht(), new CommandSend());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,20 +5,57 @@
|
|||||||
|
|
||||||
package ChatProgramm.controller.commands;
|
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
|
* @author ahren
|
||||||
*/
|
*/
|
||||||
public class CommandConnect implements CommandInterface
|
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
|
@Override
|
||||||
public void execute()
|
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
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user