lundi 13 août 2018

How to add CheckBox object in table in JAVA Swing

I am having a table which is getting data from database. But i want to add a row with checkbox having attributes as name But everytime i run the program it show the value as javax.swing.JCheckBox[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=java................etc. Here is the code.

   while(rs.next())
      {

            Vector row=new Vector();
            String name=rs.getString("name");
            String catid=rs.getString("catalogid");
            String brand=rs.getString("brand");
            String counter=rs.getString("counter");
            String qty=rs.getString("qty");
            String price=rs.getString("column_price");
            row.add(name);
            row.add(catid);
            row.add(brand);
            row.add(counter);
            row.add(qty);
            row.add(price);
            cb=new JCheckBox(name,true);
            row.add(cb);
            model.addRow(row);
      }




Aucun commentaire:

Enregistrer un commentaire