I created a subclass of JRadioButton in which I override the paintComponent method as follows:
@Override protected void paintComponent(Graphics g) { g.drawImage( isSelected() ? getCheckedImg() : getBasicImg() , 0, 0, this); }
but it seems that after the button is drawn, the image will be used forever. The isSelected test does not seem to have any effect. Graphics cached or something Java? How can I customize my JRadioButton with a selected and unselected image? Should I write a user interface?
source share