first, i'm not the best english speaker and -writer. Therefore i ask you to apologize my language mistakes

Problably in your eyes, i have a very simply problem, but i cant add the background function to Brandonio's Snake Project. I want to have a black background in the applet. After this, i want to change the color of the grid to white.

I try to add two JPanel's to snakeApplet.java. But is it still not working. Every time i started the Applet, the background is white.

In addition, i want to add music to the applet. The music should instantly playing if the applet is open.
If the idea of the black background and white grid is not to be a looker, than i would to add a picture in the background of the grid.
But i dont know how i can code it.
I hope someone can help me please
Yours sincerley
Kevin

So I think that your issue regarding changing the color of the snake game's background comes down to the way you are attempting to do so.

Basically, it looks like you are trying to add two new panels, each with a black background. Then, you add the SnakeCanvas on top of the two panels. The background of the SnakeCanvas is white, so the black JPanels get covered up.

Since SnakeCanvas extends Java's Canvas, it can have it's background color set. I think that what you may want to do is alter the code of the SnakeCanvas class to have a Black background. If that doesn't work, you can always alter the Draw function of the SnakeCanvas class to first draw a black rectangle.

Then, you will need to change the colors for everything else in SnakeCanvas's draw method.