Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel not displaying Image

 
Marcus Setchell
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Marcus
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic