This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.