I want to make the white circles of JRadioButtons transparent.
How can I do that? setOpaque(false)
only removes the background from text and not the circle.
Asked
Active
Viewed 1,377 times
-1
-
You have to play with the alpha channel. – Roman C Jun 04 '14 at 17:02
-
@RomanC ok but how do i change the fill color of the circle? – Asalas77 Jun 04 '14 at 17:03
-
possible duplicate of [Transparent JButton](http://stackoverflow.com/questions/4585867/transparent-jbutton) – james.garriss Jun 04 '14 at 17:38
2 Answers
1
Create custom Icons that use transparency for the radio button. See methods like:
setIcon(...);
setSelectedIcon(...);

camickr
- 321,443
- 19
- 166
- 288
-
I put blank 10x10 px .png file as icon, but this also removed the circle (border). Is there any way to keep it or I just have to draw it on the icon? – Asalas77 Jun 04 '14 at 17:08
-
You need to create a custom Icon that draws everything the way you want it to appear and you need to set transparent pixels where you want the icon to be transparent. These Icons replace the default Icons used by the radio button. – camickr Jun 04 '14 at 17:12
0
jRadioButton1.setVisible(false);

André Ferraz
- 1,511
- 11
- 29
-
this will hide the whole button and I only want to remove the background – Asalas77 Jun 04 '14 at 17:07