JFrame background is white on Mac, grey on PC

I have a program which uses a JFrame set to be in full-screen mode, using

DisplayMode oldMode = device.getDisplayMode();

this.setSize(new Dimension(oldMode.getWidth(), oldMode.getHeight()));

this.validate();

this.setUndecorated(true);

this.setBackground(Color.white);

this.setForeground(Color.white);

device.setFullScreenWindow(this);

I set the background to be white here, and in several other places in the code (e.g. just before a repaint() comand). However, while the background is white on the Mac I have been programming this on, it is always an ugly grey on PCs.

The various JPanels in the JFrame, all of which are set to have white backgrounds and be opaque, do indeed have white backgrounds. They just hang there as white rectangles on a grey background.

How can I get my JFrame's background to be white?

Thanks!

[995 byte] By [Asbestosa] at [2007-10-3 6:24:53]
# 1
> How can I get my JFrame's background to be white?Are you setting the background of the content pane? If not, do that rather than the JFrame itself.
kdgregorya at 2007-7-15 1:10:48 > top of Java-index,Java Essentials,New To Java...
# 2

> Are you setting the background of the content pane?

> If not, do that rather than the JFrame itself.

Is the content pane the same as the JPanels I have content in? All the JPanels have white backgrounds, but they don't necessarily tessellate together, so you can see the grey JFrame behind them.

I could possibly add a JPanel behind all the other panels, and set its background to be white, but it seems as if there ought to be some way to set the JFrame's background...

If I set the JFrame's background to be black, this shows up on the Mac, but the PC just stays grey.

Asbestosa at 2007-7-15 1:10:48 > top of Java-index,Java Essentials,New To Java...
# 3

public class MyFrame extends JFrame {

public MyFrame() {

getContentPane().setBackground(Color.white);

// etc...

}

}

Get the content pane of the frame and make modifications to it, not the frame itself.

hunter9000a at 2007-7-15 1:10:48 > top of Java-index,Java Essentials,New To Java...
# 4
Aha! Thank you very much, that works.
Asbestosa at 2007-7-15 1:10:48 > top of Java-index,Java Essentials,New To Java...