Bonjour,

Je désire affichuer unJtextField dans un Jpanel aprés que l'usger aie cliquer sur un bouton

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
 
public class FramePrincipal extends javax.swing.JFrame {
 
    public InterfacePrincipal() {
           initComponents();
     }
 
   private void initComponents() {
      panel1 = new java.awt.Panel();
  }
 
   private void RunMouseClicked(java.awt.event.MouseEvent evt) { 
       JTextField tf = new JTextField("mm");
       tf.setPreferredSize( tf.getPreferredSize() );
       tf.setText(""); // Empty the field.
        panel1.add( tf );
  }
 
   public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FramePrincipal IP = new FramePrincipal ();
                IP.setVisible(true);
 
            }
        });
 
}
mais quand je clique rien ne se passe ??