Sto cercando altre soluzioni... Riformulo il quesito, ho un database e devo inserire i dati di una tabella in una jTable creata tramite editor grafico di netbeans. Il riempimento della tabella viene effettuato da un menuItem il cui codice è il seguente:
codice:
private void jMenuTabellaClientiActionPerformed(java.awt.event.ActionEvent evt) {
try {
DatabaseOperation operation = new DatabaseOperation();
List<TupleData> dati = operation.getTransazionidouble("Clienti");
//Schema tabella
TableSchema colonne = new TableSchema("Clienti");
/* for(int i=0;i< colonne.getNumberOfAttributes();i++)
{
headers[i] = colonne.getColumn(i).getColumnName();
}*/
int i = 0;
Object[][] data = new Object[dati.size()][colonne.getNumberOfAttributes()];
for(Iterator<TupleData> it=dati.iterator();it.hasNext();){
TupleData tmp=it.next();
for(int j=0;j<tmp.tuple.size();j++){
data[i][j]=tmp.tuple.get(j);
}
i++;
}
//Fine trasformazione dati da lista a object[][]
String[] headers ={
"id_cliente",
"nome",
"cognome",
"sesso",
"data di nascita"
} ;
jTable1 = new JTable(data,headers);
for(int k = 0;k<dati.size();k++){
for(int h=0;h<colonne.getNumberOfAttributes();h++){
jTable1.setValueAt(data[k][h], k, h);
}
jFrameVistaTabelle.validate();
jFrameVistaTabelle.repaint();
jFrameVistaTabelle.doLayout();
}
} catch (SQLException ex) {
Logger.getLogger(Interfaccia.class.getName()).log(Level.SEVERE, null, ex);
}
jFrameVistaTabelle.show();
}
Quando eseguo mi fa vedere la tabella non popolata
... Qual'è l'errore?
Ho anche visto da qui ma niente :
http://forum.html.it/forum/showthread/t-1215788.html
Fatemi sapere, grazie