You need to think of a stack of layers (JPanels/Composites). There must be
- a background layer (colored)
- a border layer (transparent with the borders of the game field)
- at least one bonus layer (for the fruits, also transparent)
- a action layer (for the snake, also transparent)
- a layer for animations(?)
... and so on. That makes it easier for you to draw things on it. You can also add and delete layers while runtime (thinking of game levels...).
Also check this:
How to Use Layered Panes @ oracle.com[
^]
regards
Torsten