Adding an Icon to the Label of a JRadioButton Component

Unlike a JButton, setIcon() does not add an icon to the text label. Rather, in a radio button, the method is used to customize the icons used to depict its state. However, by using the HTML capabilities in a label, it is possible to add an icon to the label without affecting the state-depicting icons. This technique is identical to the one used for checkboxes. For more information, see Adding an Icon to the Label of a JCheckBox Component.

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.