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