Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/01/2011, 10:58
porito
 
Fecha de Ingreso: junio-2010
Mensajes: 44
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: guardar jtable en bb.dd, solo filas seleccionadas

Cita:
Iniciado por farfamorA Ver Mensaje
Supón que tienes una tabla de 10 filas, y se han seleccionado las filas 1, 3, 4, 10. Por lo tanto, el método te devolvería el arreglo filasSelec = {1,3,4,10}.
Código Java:
Ver original
  1. int[] filasSelec = jTable1.getSelectedRows();
Entonces haces un bucle para recorrerlo de la siguiente manera:
Código Java:
Ver original
  1. for( int i = 0; i < filasSelec.length; i++){
  2. String id = (String) jTable1.getValueAt(jTable1.getSelectedRow(filasSelec[i]), 0);
  3. ...
  4. }
Salu2.
Código:
String id = (String) jTable1.getValueAt(jTable1.getSelectedRow(filasSelec[i]), 0);
Esa linea me da error...porque el getSelectedRow no me acepta parametros.
Supongo que te refieres a hacer:

String id = (String) jTable1.getValueAt(filasSelec[i], 0);

No?