apres modif mon code ressemble à ça :
dans mon constructeur :
dans mon actionperformed :
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 JTable jTable2 = new JTable(); this.jTable2 = jTable2; JScrollPane jScrollPane12 = new JScrollPane(); String[] titreColonnes = { "Numero du chantier", "Nom du chantier", "Client","Calculateur", "Dessinateur"}; this.jTable2.setModel(new MyTableModel(/*chelou,*/ titreColonnes)); this.jTable2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumn col; col = this.jTable2.getColumnModel().getColumn(0); col.setPreferredWidth(60); col = this.jTable2.getColumnModel().getColumn(1); col.setPreferredWidth(350); col = this.jTable2.getColumnModel().getColumn(2); col.setPreferredWidth(110); getContentPane().add(jScrollPane12,new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 20, 700, 500)); jScrollPane12.setOpaque(true); this.jTable2.setOpaque(true); jScrollPane12.setViewportView(this.jTable2); this.jScrollPane2= jScrollPane12;
hum je me sens bete car j'ai une erreur : a ce moment il ne connait pas ma variable jTable2 lorsque je fais mon setData ???
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 bou = (String)jComboBox1.getSelectedItem(); String theta = noyau.bddChantierEnCourEmployes.chopeFonction(bou); int chalou = noyau.bddChantierEnCourEmployes.chopeLongueurColSansFiniArchive(bou, theta); String paf = ""; paf = paf.valueOf(chalou+" chantiers en cours"); jLabel1.setText(paf); Object chelou[][]= noyau.bddChantierEnCourEmployes.chopeListeChantier(chalou,bou,theta); MyTableModel.jTable2.setData(chelou);





Répondre avec citation




Partager