|
hi there, im new to the site and was just wondering if someone could please help me. Working on a project which sells carparts. Have connected to my sql database, i am retrieving information and populating 4 comboboxes with it. I have a seperate clickhandler class for each text box, so that when the user selects something from the combobox, it should populate a row in the table, ie:combobox 1 will fill row 1, combobox2 will fill row 2 etc. However the problem im getting is that when i select something from combox1, it goes to the table fine, however when i select something from combobox 2, it goes into row 2, but i loose what i had in row1. Can anyone help me? I know i have a problem with creating a new table in every class, tried to alter this by bringing back the table from every class with info stored in it, ie: jable1.getModel();. Any help would be apreciated.
first combobox:
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4)},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"ProductId", "ItemName", "Descriptin", "Cost"
}
));
second comboBox
jTable1.getModel (javax.swing.table.DefaultTableModel(
new Object [][] {
{jTable1.getModel},
{rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4)},
{null, null, null, null},
{null, null, null, null}
}
|
|
|
|
|
|
|
|