I have to 2 tables. JTable1
and Jtable2
. Jtable1 has data displayed from the database. Jtable2 should be having checkbox
for every row in Jtable1. I want number of rows in Jtable2 equal Jtable1. These 2 tables are beside eachother.
Here is an example:
In this example there is a checkbox beside every data item. I want a checkbox generated in JTable2
for every data item in Jtable1
.
Here is a picture to get a better idea:
Here is code:
public void fetch()
{
try
{
String sqlp = "select * from american";
pst = (OraclePreparedStatement) conn.prepareStatement(sqlp);
rs = (OracleResultSet) pst.executeQuery(sqlp);
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
row =jTable1.getRowCount();
while(i!=row)
{
jTable2.add(check);
}
}
catch(Exception ex )
{
JOptionPane.showMessageDialog(null, ex);
}
}