Hi - I'm wondering if anyone has tried this before. What I'm trying to code is to have a checkbox in my JTable row but instead of putting a 'check' in the checkbox, I want to change the color of the checkbox when it's checked and leave the background of the checkbox text normal. I've tried in my TableCellRenderer class to change the background of the checkbox, but it changes the color of the entire cell not just the checkbox. I'm hoping this is something easy but as I've never coded in Swing before, I'm at a loss as to how to do it.
I attached a pic of what I'm trying to do
maybe try using a button instead?
many thanks in advance for any help I can get.
Joined: Jun 09, 2003
initial thoughts are that a checkBox without a tick/check (not that hard to do) would look strange,
and that a JRadioButton would seem more suited to displaying different colors for selected/unselected.
either way you'd need to set your own Icon
Joined: Mar 07, 2012
cool - I knew it was something easy. I know this looks horrible to me too but requirements are requirements.