Ver Mensaje Individual
  #2 (permalink)  
Antiguo 31/10/2011, 18:11
Avatar de Ronruby
Ronruby
 
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Como agregar y remover cantidades de filas de una tabla

Depende del TableModel que estes usando.

Si estas usando el modelo por defecto, DefaultTableModel, que es el que se utiliza cuando no lo especificamos al crear un JTable, hay metodos como addRow, insertRow, removeRow y setRowCount.

Este ultimo es bastante interesante:
Cita:
Sets the number of rows in the model. If the new size is greater than the current size, new rows are added to the end of the model If the new size is less than the current size, all rows at index rowCount and greater are discarded.
Mas informacion aqui

Si estas implementando tu propio TableModel heredando de AbstractTableModel, solo tendrías que manejar el objeto donde guardas tus filas y luego hacer que la tabla se "actualice" llamando al método fireTableChanged. También hay otros como fireTableRowsDeleted, fireTableRowsInserted, etc.