salut tout le monde
je veux créer deux panel sur JFrame
le premier contient un gridlayout et deuxième un autre gridlayout
le deuxième qui me pose un problème pas affichage sur la fenetre je n'ai pas trouvé l'erreur
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
 
 
 import javax.swing.*;
 import java.awt.*;
 
 
public class client       {
public static void main (String [] args ){
final JFrame frame = new JFrame();
 
final   JPanel panel = new JPanel();
panel.setLayout(new GridLayout(1,2,20,20));
panel.setBorder(BorderFactory. createEmptyBorder (30, 60, 60, 30));
panel.setSize(200,100);
 
 
 
JPanel p1= new JPanel ();
// JPanel 1
p1.setBorder(BorderFactory.createTitledBorder("client"));
  p1.setLayout(null);
 
JLabel nom =new JLabel("nom-client :");
  nom.setBounds(50,30,130,20);
 p1.add(nom) ;
 
JTextField tnom = new JTextField();
tnom.setBounds(150,30,130,30);
  p1.add(tnom) ;
 
 
JLabel code =new JLabel("numéro-client :");
  code.setBounds(50,90,130,20);
p1.add(code) ;
 
 
 JTextField tcode = new JTextField();
  tcode.setBounds(150,90,130,30);
p1.add(tcode) ;
 
panel.add(p1);
 
 
 
// JPanel 2
 
  JPanel p2 = new JPanel();
  p2.setLayout(null);
  p2.setBorder(BorderFactory.createTitledBorder("film"));
 
  JLabel type1 = new JLabel("code-film 1 :");
 JTextField ttype1 = new JTextField();
 
  type1.setBounds(50,30,130,30);
   p2.add(type1);
 
   ttype1.setBounds(150,30,130,30);
 
 
 
 p2.add(ttype1);
 
 
 JLabel  type2 =new JLabel ("code-film 2 :");
 type2.setBounds(50,80,130,30);
  p2.add(type2);
 
 
  JTextField ttype2 =new JTextField();
ttype2.setBounds(150,80,130,30);
 p2.add(ttype2);
 
 
JLabel  nombre =new JLabel ("N-fois :");
  nombre.setBounds(70,140,130,30);
p2.add(nombre);
 
 
panel.add(p2);
 
frame.setContentPane(panel);
 
 
 
// problème se pose apartir de cette ligne 
 
  final   JPanel panel2 = new JPanel();
  panel2.setLayout(new GridLayout(1,2,20,20));
  panel2.setBorder(BorderFactory. createEmptyBorder (30, 60, 60, 30));
  panel2.setSize(200,100);
 
  JPanel p5= new JPanel ();
// JPanel 1
  p5.setBorder(BorderFactory.createTitledBorder("client2"));
    p5.setLayout(null);
 
 
    JTextField prenom = new JTextField();
    prenom.setBounds(50,30,130,30);
      p5.add(tnom) ;
 
      panel2.add(p5);
frame.setContentPane(panel2);
 
 
 
 
 
frame.setTitle("client");
 
frame.setResizable(false);
frame.setSize(850,550);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
 
 
}
 
 }
merci