I want to replace the text in my radio button list by an icon.
I\'ve tried this:
rotateButton = new JRadioButton(rotateIcon.getImage());
There is no radio button constructor that allows an image as the content argument instead of a text. The only way to replace the text of a radio button by an image it is generate html and pass it as an argument to the default constructor.
import javax.swing.*;
class RadioWithImage {
public static void main(String[] args) throws Exception {
URL url = Windows_ChordsGenerator.class.getResource("/images/img1.png");
final String html = "
";
JRadioButton radioButton = new JRadioButton(html);
}
}