dcsimg
add a checkbox in swing JTable row
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, September 27, 2001 02:17 PM

hi, i create a swing jtable,now i want to add record into jtable.and wants to add a checkbox record in that.examples: i have a row like (Boolean(true),"ranjoy","sinha roy","99") so , my first column will be checkbox my code: --------------------------------------- javax.swing.table.DefaultTableModel t=new javax.swing.table.DefaultTableModel(); jtblSrchRec.setModel (t); t.addColumn((Object)"Select Name"); t.addColumn ((Object)"F Name"); t.addColumn ((Object)"L Name"); t.addColumn ((Object)"Address"); t.addRow(new Object[] {new Boolean(false),"ranjoy","sinharoy","99"});    More>>

hi, i create a swing jtable,now i want to add record into jtable.and wants to add a checkbox record in that.examples: i have a row like (Boolean(true),"ranjoy","sinha roy","99")
so , my first column will be checkbox

my code:
---------------------------------------
javax.swing.table.DefaultTableModel t=new javax.swing.table.DefaultTableModel();
jtblSrchRec.setModel (t);

t.addColumn((Object)"Select Name");
t.addColumn ((Object)"F Name");
t.addColumn ((Object)"L Name");
t.addColumn ((Object)"Address");

t.addRow(new Object[] {new Boolean(false),"ranjoy","sinharoy","99"});
----------------------------------------
so when i write this code, it add the record in to jtable, but first column is not comming as a checkbox,its comming as a string just printing "false".

please let me know how i 'll add check box in the table row?

   <<Less

Re: add a checkbox in swing JTable row

Posted By:   Prashanth_Godey  
Posted On:   Friday, September 28, 2001 10:35 AM

About | Sitemap | Contact