Meaningless Drivel is fun!
The moose likes Game Development and the fly likes JPanel not displaying Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "JPanel not displaying Image" Watch "JPanel not displaying Image" New topic

JPanel not displaying Image

Marcus Setchell

Joined: Jun 06, 2012
Posts: 10
I'm fairly new to Java but have quite a lot of experience in other programming languages. Struggling to get my head around it slightly though, I have managed to create a small maze game (Tile based) and am now refining it to make a more advanced version. But now i have begun this the method of drawing the tiles is no longer working? Scripts below -

This is the main class

And this is my map class

I have made the drawMap(); function as basic for testing purposes and have also tried it with -

Which worked a treat.

Thanks in advance - Marcus
Marcus Setchell

Joined: Jun 06, 2012
Posts: 10
Ahh i have resolved the problem it was a stupid mistake which i am actually embarrassed to admit but i will to remind people who search for the same thing to not make this mistake.

I had 2 versions of the image in the tiles directory one BMP and the other PNG. This was because i wasn't sure on which file type to use. the grass.bmp wouldn't display i think possibly because of the method im using to load the images the other was called g.png therefore i was trying to load a file that did not exists!

Sorry for the inconvenience.

It is sorta covered in the JavaRanch Style Guide.
subject: JPanel not displaying Image
jQuery in Action, 3rd edition