I would like to be able to customize the text color of my jRadioButtons. I would like them to use the color of titledBorders for my native l&f. I'm having some trouble doing this. I assume I have to set the buttonUi for my radiobuttons to some sort of custom extension, in which I set a different font for selected buttons. I haven't been able to figure out how to do this. Any thoughts?
Do you have text on a radio button? I thought you had a JLabel next to it with text on. There are setBackground() and setForeground() methods which allow colour changes; have you found them?
Joined: Oct 16, 2008
Campbell Ritchie wrote:Do you have text on a radio button? I thought you had a JLabel next to it with text on. There are setBackground() and setForeground() methods which allow colour changes; have you found them?
The radio button does have text, no label. The problem with the setForeground method, is if i set the color using it, the radiobutton doesn't turn grey when not selected. not a big deal, and probably one that i could handle with listeners. But there might a "more correct" solution by using a buttonUI? I don't want to have to add listeners to all the radiobuttons in my app.