Gestion des fenetres de clavardage
This commit is contained in:
父節點
6aa087f1bc
當前提交
65c729b9aa
共有 4 個文件被更改,包括 12 次插入 和 4 次删除
|
@ -199,8 +199,7 @@ public class ChatApp {
|
|||
|
||||
public static void main (String[] args) throws IOException {
|
||||
ChatApp app = new ChatApp(args[0],Integer.parseInt(args[1])) ;
|
||||
|
||||
|
||||
System.out.println("On lance le chatapp");
|
||||
|
||||
|
||||
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
||||
|
@ -211,6 +210,7 @@ public class ChatApp {
|
|||
e.printStackTrace();
|
||||
}
|
||||
ExecutorService execTCP = Executors.newFixedThreadPool(1000);
|
||||
System.out.println("On lance l'écoute TCP de chatapp");
|
||||
execTCP.submit(new RunnerEcouteTCP(app));
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
|
|
|
@ -27,6 +27,7 @@ public class UDPEchange {
|
|||
private static Boolean Connecte = true;
|
||||
// True si l'utilisateur peut se connecter avec ce nom d'utilisateur , False sinon
|
||||
|
||||
private static Boolean EcouteEnCours = false;
|
||||
/**
|
||||
* Getter
|
||||
* @return le boolean connecte (True s'il peut se connecter avec ce nom d'utilisateur , False sinon)
|
||||
|
|
|
@ -88,10 +88,15 @@ public class View_Accueil implements ActionListener{
|
|||
// on recupere le texte entree dans la zone de saisie
|
||||
String pseudo = pseudofield.getText();
|
||||
// On crée un objet de type ChatApp
|
||||
ChatApp app = new ChatApp(pseudo, 3000) ;
|
||||
System.out.println("Lancement du ChatApp");
|
||||
ChatApp app = new ChatApp(pseudo, 1234) ;
|
||||
// on crée un thread qui va ecouter les connexions entrantes
|
||||
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
||||
System.out.println("Lancement de UDP");
|
||||
execUDP.submit(new RunnerEcouteUDP(app));
|
||||
ExecutorService execTCP = Executors.newFixedThreadPool(1000);
|
||||
System.out.println("On lance l'écoute TCP de chatapp");
|
||||
execTCP.submit(new RunnerEcouteTCP(app));
|
||||
Boolean connexion = false ;
|
||||
try {
|
||||
// on tente une connexion avec ce pseudo
|
||||
|
|
|
@ -35,6 +35,7 @@ import javax.swing.JTextField;
|
|||
import javax.swing.SwingConstants;
|
||||
|
||||
import src.Controller.*;
|
||||
import src.Protocoles.SessionClavardage;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.Color;
|
||||
|
@ -186,7 +187,8 @@ public class View_Menu {
|
|||
cb.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Object selected = cb.getSelectedItem();
|
||||
new View_Clavardage(app, selected.toString());
|
||||
SessionClavardage session = new SessionClavardage(Utilisateur.stringToUtilisateur(selected.toString()),app);
|
||||
new ViewSession(session);
|
||||
|
||||
}
|
||||
});
|
||||
|
|
載入中…
Reference in a new issue