I have this method that theoretically loads two ArrayList into a JTable
public void CargarJTbable() {
DefaultTableModel modelo = new DefaultTableModel();
modelo.addColumn("ID");
modelo.addColumn("RUT");
modelo.addColumn("NOMBRE");
modelo.addColumn("APELLIDO");
modelo.addColumn("TELEFONO");
modelo.addColumn("TALLER");
for (PersonaDTO pers : p.leerPersonaTodos()) {
Object[] fila = new Object[5];
fila[0] = pers.getId();
fila[1] = pers.getRut();
fila[2] = pers.getNombre();
fila[3] = pers.getApellido();
fila[4] = pers.getTelefono();
modelo.addRow(fila);
}
for (TallerDTO tall : t.leerTallerTodos()){
Object[] fila = new Object[1];
fila[0] = tall.getNombre();
modelo.addRow(fila);
}
tbl_datos.setModel(modelo);
}
In theory the last 3 data should be inserted in "Workshop"
Could you help me find the logic to put the data from the list "t.leerTallerAll ()" and add them to "Workshop EDIT: I tried to load it in field 5 but it throws me an error, attached img.
EDIT 2: Now that I changed the code
Object[] fila = new Object[6];
fila[5] = tall.getNombre();
I'm loaded into "Workshop" but below, I should start from the top.
It should be like this. The last field is empty because that person is not associated with a workshop. I edited it manually but I can not do it automatically from the code: (