Setting background color for a JButton

My java applet includes a dialog where some JButtons have specified colors. The code I have is basically as follows:

JButton button =new JButton();

button.setBackgroundColor(Color.red);

This works fine with some JRE versions, but JRE 1.4.2-06 displays a thin border in red, and the body of the button is white (or perhaps a light gray color). Any ideas on how to make the whole button red?

Thanks.

[462 byte] By [MCorazao3a] at [2007-10-2 9:17:46]
# 1
Are you displaying an icon in the button? That could have its own background colour.
TimRyanNZa at 2007-7-16 23:24:52 > top of Java-index,Desktop,Core GUI APIs...
# 2

You can create one using BufferedImage (to fit the size of the Button)

The code to do this looks like this:

JButton button = new JButton("Me!!");

int width = 50, height = 50;

BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

Graphics g = buffImg.getGraphics();

g.setColor(Color.red);

g.fillRect(0, 0, width, height);

button.setIcon(new ImageIcon(buffImg));

JGuru23a at 2007-7-16 23:24:52 > top of Java-index,Desktop,Core GUI APIs...