1

I am using RGBA for the coloring. I want the button transparent, but to be able to set the degree of transparency, hence the alpha. Now it looks fine until I do anything that calls a repaint/paint like hover or focus. If I set opaque to false, it does make it transparent, I just don't want this 100% transparent. It is not the image I paint in the background either. It does not have a problem with RGB, just RGBA.

these don't work:

jButton1.setContentAreaFilled(true or false);
jButton1.setOpaque(true or false);

Here is my jButton color code:

jButton1.setBackground(new Color(255,0,0,100));

Here is what it looks like.jbutton glitch

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1753429
  • 89
  • 1
  • 7

1 Answers1

3

Your problem looks something like this. The answers there may help you get the translucency right, but you'll need to do it in a custom ButtonUI, illustrated here.

Before: before

After: after

ButtonUI: buttonui

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
trashgod
  • 203,806
  • 29
  • 246
  • 1,045