From 2562a1ed3bbe03085c8c3ff8619ab7da852a2c5d Mon Sep 17 00:00:00 2001 From: tgiraud Date: Tue, 15 Dec 2020 17:48:41 +0100 Subject: [PATCH] le commit sournois --- .../Clavardage/src/controller/Controller.java | 7 +++++++ Application/Clavardage/src/view/Interface.java | 17 ++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Application/Clavardage/src/controller/Controller.java b/Application/Clavardage/src/controller/Controller.java index 65c21c8..2488cae 100644 --- a/Application/Clavardage/src/controller/Controller.java +++ b/Application/Clavardage/src/controller/Controller.java @@ -69,6 +69,12 @@ public class Controller { this.tcp_connect_thread.start(); notify_remote_users(); + + javax.swing.SwingUtilities.invokeLater(new Runnable() { + public void run() { + hisView.createAndShowGUI(); + } + }); } /** @@ -160,6 +166,7 @@ public class Controller { //sc1.close(); JOptionPane.showMessageDialog(null ,"Your nickname : " + tmpPseudo + " is valid !"); + hisView.Pseudolabel.setText("Your current username is: " + tmpPseudo); return tmpPseudo; } diff --git a/Application/Clavardage/src/view/Interface.java b/Application/Clavardage/src/view/Interface.java index 6489fb7..4b6ce58 100644 --- a/Application/Clavardage/src/view/Interface.java +++ b/Application/Clavardage/src/view/Interface.java @@ -4,17 +4,20 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.IOException; +import controller.Controller; public class Interface implements ActionListener { + + public Controller hisController; - private JLabel Pseudolabel; - private JTextField PseudotextField; + public JLabel Pseudolabel; + public JTextField PseudotextField; - private JLabel Messagelabel; - private JTextField MessagetextField; + public JLabel Messagelabel; + public JTextField MessagetextField; - private JButton RemoteUserButton; - private JLabel RemoteUserlabel; + public JButton RemoteUserButton; + public JLabel RemoteUserlabel; //Specifies the look and feel to use. Valid values: //null (use the default), "Metal", "System", "Motif", "GTK+" @@ -125,7 +128,7 @@ public class Interface implements ActionListener { * this method should be invoked from the * event-dispatching thread. */ - private static void createAndShowGUI() { + public static void createAndShowGUI() { //Set the look and feel. initLookAndFeel();