• Post Reply Bookmark Topic Watch Topic
  • New Topic

add check box to DefaultTableModel in swing  RSS feed

 
ritz Mohamed
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i want to add a JCheckbox into TableModel Object .....
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Override the getColumnModel method to make it return Boolean.class for that column. But you could have found that out if you would SearchFirst.
 
ritz Mohamed
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx for replay..but i need to add a check box dynamicaly.....while adding new row for the table....
here is code
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ritz Mohamed wrote:thnx for replay..

Please UseRealWords: "thanks". And also, UseCodeTags next time.
 
Rob Camick
Ranch Hand
Posts: 2788
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the suggestion was to override the getColumnClass() method to return a Boolean value for the column with the check box and to add a Boolean object to the TableModel for the column.

So where in your code have you implemented this advice?

I suggest you read the JTable API and follow the link to the Swing tutorial on "How to Use Tables" for a working example that displays check boxes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!