0

I tried googling it but i cant get past the million posts about unselecting radio buttons... Anyways, my problem is my radio buttons (all my buttons actually) look ugly:

enter image description here

Is there any way to replace the background of them with this:

enter image description here

...or make them transparent? Any help will be greatly appreciated.

neubert
  • 15,947
  • 24
  • 120
  • 212
Kevin
  • 167
  • 1
  • 12

1 Answers1

0

Take make them transparent, simply use setOpaque(false)

To change the background, you'll need to bet creative. The basic idea would be to load the background image and apply it to something like a JLabel, setting the labels layout manager and add the button to it.

The more complex solution would be to split the background image into 9 sections (4 borders, top, bottom, left and right edges and centre), draw each to their respective areas and providing some means for supporting child components.

This is going to require some custom painting and creatie layout management.

I'd also recommend taking a look at Swings Look and Feel support

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366