I'm making a custom TableModel usingAbstractTableModel
for a project, and I need to figure out a way to have a checkbox show up on some rows, but not others. I have already implemented a getColumn method, but I want to be able to have a checkbox not show up unless a certain condition in another column is reached (for example, if the object represented by a particular row is a lightbulb rather than, say, a toaster, give the user a checkbox to turn the light on or off).
I've tried using getValueAt and passing null or a string instead of a Boolean object in the hopes that maybe Swing wouldn't render the checkbox. And it doesn't, but it also throws a nasty set of ClassCastExceptions for trying to cast a String to a Boolean.
Does anyone have any ideas on how I could do something like this?