Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding backgroundcolor to snake applet
#2
Kevin,

Welcome to BP Forums! 

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.
My Blog | My Setup | My Videos | Have a wonderful day.
Reply


Messages In This Thread
Adding backgroundcolor to snake applet - by Kevin - 08-28-2015, 08:51 AM
RE: Adding backgroundcolor to snake applet - by brandonio21 - 09-01-2015, 10:09 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)