0

I created a JFrame and set the color to white with setBackground(Color.WHITE), but the color is not white but a bit gray.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
AgonLat
  • 11
  • 3
  • Possible duplicate of: https://stackoverflow.com/questions/1081486/setting-background-color-for-a-jframe – vivek Mar 11 '22 at 09:05
  • Guess: The panel added for the components entirely covers the white BG. That looks like the standard color of a `JPanel`. For anything better than guesses, [edit] to add a [mre]. – Andrew Thompson Mar 16 '22 at 05:09

1 Answers1

0

Doing frame.setBackground() won't work. You need to do it like this:

frame.getContentPane().setBackground(Color.white);
RobC
  • 22,977
  • 20
  • 73
  • 80