bonjour,
j'ai un JTabbedpane qui contient 3 onglets. lors du lancement du l'application c le premier onglet qui apparait.cet onglet est gere par plusieurs Jpanel .le probleme c que le jpanel contenat un Jtable ne s'affiche pas que si je clique dedans ou j'aille sur un autres onglet et je reviens sur celui-ci ou je modifie la taille de la fentere. ce mm pb existe aussi avec des autres Jframe.qq a une idee pour resoudre ca?

voila le code de la frame principale
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
package aymen;
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
 
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
//import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern;
//import com.sun.org.apache.xerces.internal.impl.xs.identity.Selector.Matcher;
 
public class ajoutClient extends JFrame implements ActionListener{
 
	//la variable choix pour l'ajout ou la modification 1:ajout;2:modification
	int choix;
	int id_client;
	accesBD bd;
	//tableau contenant les jTextfield
	JTextField[] tabF=new JTextField[9];
 
	//les panels
	JPanel detC=new JPanel();
	JPanel panel=new JPanel();
	JPanel Bpanel=new JPanel();
 
	//les layouts manager
	GridLayout gl=new GridLayout(9,2);
	BorderLayout bl=new BorderLayout();
 
	//les bouton
	JButton ok=new JButton("ok");
	JButton annuler=new JButton("annuler");
 
	//les labels
	JLabel nom=new JLabel("nom");
	JLabel prenom=new JLabel("prenom");
	JLabel cin=new JLabel("CIN");
	JLabel rs=new JLabel("raison social");
	JLabel tel=new JLabel("TEL");
	JLabel fax=new JLabel("FAX");
	JLabel mf=new JLabel("matricule fiscale");
	JLabel rc=new JLabel("rc");
	JLabel address=new JLabel("adresse");
 
	//les champs du texte
	JTextField nomf =new JTextField(30);
	JTextField prenomf =new JTextField(30);
	JTextField cinf =new JTextField(30);
	JTextField rsf =new JTextField(30);
	JTextField telf =new JTextField(30);
	JTextField faxf =new JTextField(30);
	JTextField mff =new JTextField(30);
	JTextField rcf =new JTextField(30);
	JTextField  addressf=new JTextField(60);
 
	//les variables de verification
	 String cinv=" ";
	 String telv=" ";
	 String faxv=" ";
	 String nomv=" ";
	 String prenomv=" ";
	 String mfv=" ";
	 String rcv=" ";
	 String addressv=" ";
	 String rsv=" ";
 
	 /***************************constructeur n°1*********************************/
	public ajoutClient(int choix) {
		this.choix=choix;
		affichage();
		ok.addActionListener(this);
		annuler.addActionListener(this);
	}
 
	/*************************constructeur n°2*************************************/
	public ajoutClient(int choix, int id_client) {
		this.choix=choix;
		this.id_client=id_client;
		affichage();
 
		//ajout des action listener pour les bouton
		ok.addActionListener(this);
		annuler.addActionListener(this);
		bd=new accesBD();
		bd.ouverture();
		bd.req="Select * FROM client where (id_client ='"+id_client+"')";
		bd.reqSelect();
		try {
			while(bd.res.next()){
			cinf.setText(bd.res.getString("cin"));	
			nomf.setText(bd.res.getString("nom"));
			prenomf.setText(bd.res.getString("prenom"));
			telf.setText(bd.res.getString("tel"));
			faxf.setText(bd.res.getString("fax"));
			rsf.setText(bd.res.getString("raison social"));
			mff.setText(bd.res.getString("mf"));
			rcf.setText(bd.res.getString("rc"));
			addressf.setText(bd.res.getString("adresse"));
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
 
	}
 
	//fonction permettant l'affichage de la page vide
    public void affichage()
   {
    	this.setTitle("MainFrame");
        this.setSize(400, 400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);  
        this.setVisible(true);
 
        panel.setLayout(bl);
        detC.setLayout(gl);
        bl.setVgap(20);
        bl.setHgap(20);
        gl.setHgap(15);
        gl.setVgap(5);
 
        //ajout des composant au panel principale
        panel.add(detC, BorderLayout.CENTER);
        panel.add(new JLabel("veuillez entrer les details du nouveau client"), BorderLayout.NORTH);
        panel.add(Bpanel,BorderLayout.SOUTH);
 
        //aout des composant au Bpanel
        Bpanel.add(ok);
        Bpanel.add(annuler);
        this.setContentPane(panel);
 
        //ajout des composants au panel detC
        detC.add(nom);
        detC.add(nomf);
        detC.add(prenom);
        detC.add(prenomf);
        detC.add(cin);
        detC.add(cinf);
        detC.add(rs);
        detC.add(rsf);
        detC.add(tel);
        detC.add(telf);
        detC.add(fax);
        detC.add(faxf);
        detC.add(mf);
        detC.add(mff);
        detC.add(rc);
        detC.add(rcf);
        detC.add(address);
        detC.add(addressf);
   }
 
    //la fonction Action performed
    public void actionPerformed(ActionEvent evt){
		Object source = evt.getSource();
		bd=new accesBD();
		bd.ouverture();
		if(source==ok)
		{
			Verifier verif=new Verifier(cinf.getText());
        //verif.verifierCin();
        verif.verifierINT();
        cinv=cinf.getText();
        nomv=nomf.getText();
        prenomv=prenomf.getText();
        rsv=rsf.getText();
        telv=telf.getText();
        faxv=faxf.getText();
        mfv=mff.getText();
        rcv=rcf.getText();
        addressv=addressf.getText();
		if(choix==1)
		{
 
			try {
				int i=bd.stat.executeUpdate("INSERT INTO `client` ( `cin` , `nom` , `prenom` , `raison social` , `tel` , `fax` , `adresse` , `mf` , `rc`  )VALUES ( '"+
						cinv+"' , '"+nomv+"' , '"+prenomv+"' , '"+rsv+"' , '"+telv+"' , '"+faxv+"' , '"+addressv+"' , '"+mfv+"' , '"+rcv+"')");
 
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
 
		}
       if(choix==2)
       {
    	   System.out.print("hello");
    	   try {
    		   System.out.print("hello2");
    		   String requet="UPDATE `client` SET `cin` = '"+cinv+"', nom = '"+nomv+"' , `prenom` = '"+prenomv+"',`raison social` = '"+rsv+"', `tel` = '"+telv+
    		   "', `fax` = '"+faxv+"',`adresse` = '"+addressv+"',`mf` = '"+mfv+"',`rc` = '"+rcv+"' WHERE `client`.`id_client` ="+id_client;
    		   //String requet="UPDATE client SET \"cin\" = \""+cinv+"\",\"nom\" = \""+nomv+"\", \"prenom\" = \""+prenomv+"\", \"raison social\" = \""+rsv+"\", \"tel\" = \""+telv+"\", \"fax\" = \""+faxv+"\",\"adresse\" = \""+addressv+"\",\"mf\" = \""+mfv+"\",\"rc\" = \""+rcv+"\" WHERE id_client ="+id_client;
			   //String requet="UPDATE client SET cin="+cinv+" Where id_client="+id_client;
			   System.out.println(requet);
    		  //PreparedStatement pre=bd.con.prepareStatement(requet);
    		  //System.out.println(nomv);
    		  //pre.setString(1, nomv);
    		  //bd.fermeture();
    		  // int i=bd.stat.executeUpdate("UPDATE client SET \"cin\" = \""+cinv+"\",\"nom\" = \""+nomv+"\", \"prenom\" = \""+prenomv+"\",\"raison social\" = \""+rsv+"\", \"tel\" = \""+telv+"\", \"fax\" = \""+faxv+"\",\"adresse\" = \""+addressv+"\",\"mf\" = \""+mfv+"\",\"rc\" = \""+rcv+"\" WHERE id_client ="+id_client);
    		  int i=bd.stat.executeUpdate(requet);
    		  bd.fermeture();
			} catch (SQLException e) {
				System.out.print("hello3");
				e.printStackTrace();
			}	  
       }
		}
    }
 
	public static void main(String[] args) {
		ajoutClient aa=new ajoutClient(2,12);
 
	}
 
}
merci