How to do so that when I select the checkbox of one row and select another checkbox from another row it is stored in a variable and when I click the send button it is sent to another table to be validated.
This is the creation code of the table:
tbDocTransferir.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"C. Costo", "Cod. SD", "Tipo de Archivo", "N\u00B0 Doc.", "Permanencia", "Tipo de Nivel de Archivo", "Per. Ret.", "Solicitar"
}
) {
@SuppressWarnings("rawtypes")
Class[] columnTypes = new Class[] {
Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Boolean.class
};
@SuppressWarnings({ "unchecked", "rawtypes" })
public Class getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
boolean[] columnEditables = new boolean[] {
false, false, false, false, false, false, false, true
};
public boolean isCellEditable(int row, int column) {
return columnEditables[column];
}
});
tbDocTransferir.getColumnModel().getColumn(0).setPreferredWidth(93);
tbDocTransferir.getColumnModel().getColumn(1).setPreferredWidth(87);
tbDocTransferir.getColumnModel().getColumn(2).setPreferredWidth(125);
tbDocTransferir.getColumnModel().getColumn(4).setPreferredWidth(95);
tbDocTransferir.getColumnModel().getColumn(5).setPreferredWidth(150);
tbDocTransferir.getColumnModel().getColumn(6).setPreferredWidth(92);
tbDocTransferir.getColumnModel().getColumn(7).setPreferredWidth(61);
tbDocTransferir.setDefaultRenderer(Object.class, new Mirender());
scrollPane.setViewportView(tbDocTransferir);
tbDocTransferir.setRowSelectionAllowed(true);
tbDocTransferir.setColumnSelectionAllowed(false);
This code is so that the information that is in the database is listed in the table:
void ListarDocumento(String centroCosto){
ArrayList<ServicioArchivisticoDTO> doc = x.ListarDocumento(centroCosto);
DefaultTableModel model = (DefaultTableModel) tbDocTransferir.getModel();
model.setRowCount(0);
for (ServicioArchivisticoDTO s : doc){
Object fila[] = {s.getCentroCosto().getC_t_costo(), s.getSerieDocumental().getC_c_sd(), s.getTipoArchivo().getC_t_tipo_archivo(),
s.getArchivo().getC_t_doc(), s.getSerieDocumental().getN_i_tiempo_retencion()+" años", s.getNivelArchivo().getC_t_nivel_archivo(),
s.getPeriodo_retencion()};
model.addRow(fila);
}
}