bonjour

je dois realiser un programme de chat entre different client... alors au niveau de l'interface graphique le client doit d'abord ecrir son pseudo ainsi il serat connecté mais j'arrive pas a effectuer l'operation car lorsque le client ajoute son pseudo et appuis sur entrer rien ne se passe .... il s'agit d'un evenement ou action
voila mon programme qui permet de connecter le client dés qu'il rajoute son
pseudo

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
 
public class ChatClient extends UnicastRemoteObject implements InterfaceChatClient{
    private static final long serialVersionUID = 1L;
    String pseudo;
    static ClientInt C1=new ClientInt();
 
    public ChatClient(String pseudo) throws RemoteException {
        super();
        this.pseudo=pseudo;
 
    }
    public String getPseudo()throws RemoteException{
        return pseudo;
    }
 
    public void diffuseMessage(Message m) throws RemoteException {
        System.out.println(""+m.getMessage());
    }
 
 
    public static void main(String args[]) throws RemoteException, UnknownHostException{
 
        //public void actionPerformed(ActionEvent arg0){
        C1.setVisible(true);
 
 
        ChatClient C=new ChatClient(C1.jTextField2.getText());
        try {
 
 
 
 
            InterfaceChatServeur c=(InterfaceChatServeur) Naming.lookup("rmi://"+InetAddress.getLocalHost().getHostAddress()+"/hello");
            Naming.rebind("client",C);
            Message msg;
            msg=new Message(C1.jTextField2.getText(),"oui c'est moi");
            c.connect(msg.getpseudo(),"client");
            //c.disconnect("ghassan");
            //envoyer le message aux clients connectés
            c.broadcastMessage(msg,"client");
 
 
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (NotBoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
 
        System.out.println(C1.jTextField2.getText());
 
 
    }
 
        }
et la le programme de l'interface graphique.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
 
 
 
 
import java.awt.BorderLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JButton;
import javax.swing.JLabel;
 
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
 
 
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit <a href="http://www.cloudgarden.com" target="_blank">www.cloudgarden.com</a> for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ClientInt extends javax.swing.JFrame {
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private JPanel jPanel1;
    private JTextArea jTextArea1;
    private JLabel jLabel1;
    private JLabel jLabel4;
    private JLabel jLabel6;
    private JLabel jLabel5;
    private JLabel jLabel3;
    public static JTextField jTextField2;
    public JLabel jLabel2;
    private JButton jButton1;
    private JTextField jTextField1;
    private String hour;
    public  String couocu=null;
 
    /**
    * Auto-generated main method to display this JFrame
    */
    public static void main(String[] args) {
        ClientInt inst = new ClientInt();
        inst.setVisible(true);
    }
 
    public ClientInt() {
        super();
        initGUI();
    }
 
    private void initGUI() {
        String msg = "";
        Message ms=new Message("momo",msg);
        try {
            {
                jPanel1 = new JPanel();
                getContentPane().add(jPanel1, BorderLayout.CENTER);
                LayoutManager jPanel1Layout = null;
                jPanel1.setLayout(jPanel1Layout);
                jPanel1.setPreferredSize(new java.awt.Dimension(392, 441));
                jPanel1.setLayout(null);
                {
                    jTextArea1 = new JTextArea();
                    //ChatClient Client=new ChatClient("momo","url");
                    jPanel1.add(jTextArea1);
                    //jTextArea1.setText(""+ Client.diffuseMessage(ms)/*+jTextField1.getText()*/);
                    jTextArea1.setBounds(14, 42, 364, 315);
                }
                {
                    jButton1 = new JButton();
                    jPanel1.add(jButton1);
                    jButton1.setText("Submit");
                    jButton1.setBounds(147, 392, 84, 28);
                }
                {
                    jTextField1 = new JTextField();
                    jPanel1.add(jTextField1);
                    jTextField1.setText("");
                    msg=jTextField1.getText();
                    jTextField1.setBounds(14, 364, 364, 21);
                }
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("Heure Serveur:");
                    jLabel1.setBounds(168, 0, 77, 21);
                    {
                        jLabel4 = new JLabel();
                        jLabel1.add(jLabel4);
                        jLabel4.setText("Heure Client");
                        jLabel4.setBounds(28, 14, 63, 28);
                    }
                }
                {   
                    //H=new ex2.HeureServeur();
                    jLabel2 = new JLabel();
                    jPanel1.add(jLabel2);
                    jLabel2.setText("");
                    jLabel2.setBounds(252, 0, 35, 21);
                }
                {   
                    jTextField2 = new JTextField();
                    jPanel1.add(jTextField2);
                    jTextField2.setBounds(49, 7, 105, 21);
                    //couocu=jTextField2.getText();
                    jTextField2.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            //System.out.println("jTextField2.actionPerformed, event="+evt);
                            //jTextField2.setText("");
                            if(evt.getSource()==jTextField2)
                            jTextField2.getText();
 
                        }
                    });
                }
                {
                    jLabel3 = new JLabel();
                    jPanel1.add(jLabel3);
                    jLabel3.setText("Pseudo");
                    jLabel3.setBounds(7, 7, 35, 21);
                }
                {
                    jLabel5 = new JLabel();
                    jPanel1.add(jLabel5);
                    jLabel5.setText("HeureClient:");
                    jLabel5.setBounds(168, 14, 63, 21);
                }
                {
                    jLabel6 = new JLabel();
                    jPanel1.add(jLabel6);
                    //hour=(String)System.currentTimeMillis();
                    jLabel6.setText("");
                    jLabel6.setBounds(238, 14, 42, 21);
                }
            }
            this.setSize(400, 450);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
}
merci pour votre aide.