Gestion des fenetres de clavardage
This commit is contained in:
parent
6aa087f1bc
commit
65c729b9aa
4 changed files with 12 additions and 4 deletions
|
@ -199,8 +199,7 @@ public class ChatApp {
|
||||||
|
|
||||||
public static void main (String[] args) throws IOException {
|
public static void main (String[] args) throws IOException {
|
||||||
ChatApp app = new ChatApp(args[0],Integer.parseInt(args[1])) ;
|
ChatApp app = new ChatApp(args[0],Integer.parseInt(args[1])) ;
|
||||||
|
System.out.println("On lance le chatapp");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
||||||
|
@ -211,6 +210,7 @@ public class ChatApp {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ExecutorService execTCP = Executors.newFixedThreadPool(1000);
|
ExecutorService execTCP = Executors.newFixedThreadPool(1000);
|
||||||
|
System.out.println("On lance l'écoute TCP de chatapp");
|
||||||
execTCP.submit(new RunnerEcouteTCP(app));
|
execTCP.submit(new RunnerEcouteTCP(app));
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class UDPEchange {
|
||||||
private static Boolean Connecte = true;
|
private static Boolean Connecte = true;
|
||||||
// True si l'utilisateur peut se connecter avec ce nom d'utilisateur , False sinon
|
// True si l'utilisateur peut se connecter avec ce nom d'utilisateur , False sinon
|
||||||
|
|
||||||
|
private static Boolean EcouteEnCours = false;
|
||||||
/**
|
/**
|
||||||
* Getter
|
* Getter
|
||||||
* @return le boolean connecte (True s'il peut se connecter avec ce nom d'utilisateur , False sinon)
|
* @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
|
// on recupere le texte entree dans la zone de saisie
|
||||||
String pseudo = pseudofield.getText();
|
String pseudo = pseudofield.getText();
|
||||||
// On crée un objet de type ChatApp
|
// 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
|
// on crée un thread qui va ecouter les connexions entrantes
|
||||||
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
ExecutorService execUDP = Executors.newFixedThreadPool(1000);
|
||||||
|
System.out.println("Lancement de UDP");
|
||||||
execUDP.submit(new RunnerEcouteUDP(app));
|
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 ;
|
Boolean connexion = false ;
|
||||||
try {
|
try {
|
||||||
// on tente une connexion avec ce pseudo
|
// on tente une connexion avec ce pseudo
|
||||||
|
|
|
@ -35,6 +35,7 @@ import javax.swing.JTextField;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
import src.Controller.*;
|
import src.Controller.*;
|
||||||
|
import src.Protocoles.SessionClavardage;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
@ -186,7 +187,8 @@ public class View_Menu {
|
||||||
cb.addActionListener(new ActionListener() {
|
cb.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
Object selected = cb.getSelectedItem();
|
Object selected = cb.getSelectedItem();
|
||||||
new View_Clavardage(app, selected.toString());
|
SessionClavardage session = new SessionClavardage(Utilisateur.stringToUtilisateur(selected.toString()),app);
|
||||||
|
new ViewSession(session);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue