Best regards I have a jcombobox mat_codigo, mat_des, mat_preciovta I need to pass the values to a table as the description in column (1) and the price vta in the coulman (3) as it is in the image
My code is the following: public void ShowComboBoxCategoria () { DefaultComboBoxModel value1; try { Statement sent = Conn.createStatement ();
String sql = "select mat_codigo,mat_des,mat_preciov from materiales order by mat_codigo asc";
ResultSet rs = sent.executeQuery(sql);
value1 = new DefaultComboBoxModel();
cmb_cat.setModel(value1);
while (rs.next()) {
value1.addElement(new CmbObtener(rs.getString("mat_des"), rs.getString("mat_codigo"),rs.getString("mat_preciov")));
}
rs.close();
Conn.close();
} catch (Exception ex) {
System.out.println(ex.getCause());
}}
public class CmbObtain {
private String datoItem;
private String id;
private String preciov;
public CmbObtener(String datoItem, String id,String preciov) {
this.datoItem = datoItem;
this.id = id;
this.preciov=preciov;
}
public String getID() {
return id;
}
public String toString() {
return datoItem;
}
public String getpreciov() {
return preciov;
}
}
But the jcombox is not visible in the table. I appreciate your cordial support.saluds