the list contains some records and when you click it, it is added to the table but the table is superimposed on the list
I do not know if there is a property of the table that allows me to remove that or the list so that it does not happen
this is the code of the list
private void Lista2MouseClicked(java.awt.event.MouseEvent evt) {
Modelo = (DefaultTableModel) TablaVentas.getModel();
String nombrepuesto;
int size = 0, cont = 0;
String name = Lista2.getSelectedValue();
BuscarRespuesto.setText(name);
size = Modelo.getRowCount();
if (size == 0) {
MostrarVentas(name);
Calcular();
} else {
if (size == 26) {
JOptionPane.showMessageDialog(this, "disculpe solo 26 repuestos", "Error", JOptionPane.INFORMATION_MESSAGE);
} else {
size = Modelo.getRowCount();
for (int i = 0; i < Modelo.getRowCount(); i++) {
nombrepuesto = (String) Modelo.getValueAt(i, 2);
if (!name.equals(nombrepuesto)) {
cont = 1;
} else {
cont = 2;
break;
}
}
if (cont == 1) {
if (size > 26) {
JOptionPane.showMessageDialog(this, "disculpe solo 26 repuestos", "Error", JOptionPane.INFORMATION_MESSAGE);
} else {
MostrarVentas(name);
Calcular();
}
} else {
JOptionPane.showMessageDialog(this, "ya selecciono ese repuesto", "Error", JOptionPane.INFORMATION_MESSAGE);
}
}
}
}
use the click event to be added to the table, I sent it to show by parameter the name and it shows it along with the other records