JFrame setBackground failure with contentPane
807601Apr 15 2008 — edited Apr 16 2008Hi. This is the first time I am using swing and I seem to be having some trouble. Compiling my code in java 5 and running it on a mac seemed to work fine, but as soon as I went over to a PC (I am a PC user myself) I got some problems. I've seen plenty of suggestions to use getContentPane().setBackground(*color*), but when I tried that it didn't change anything. When I run my program the frame pops up and whatever was behind it at the time it was created becomes the background. Everything that I paint just gets painted over that background, and it doesn't refresh, so if I move a square across the frame it will leave a trail behind itself. The reason I am using swing is mainly for it's double-buffering, so filling in my background every time paint() is called is just a waste and brings me right back to the flicker problems I have with awt. Does anyone know why this is happening and how I can fix it?