This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • 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: 20893
81
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: 20893
81
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: 2752
11
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!