Skip to main content

Calling method prevents drawing

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-12-29

Hi everyone I've been struggling a bit im a little new to java and all but uh I've been slowly working on a game since I understand enough.

With that I have a panel class which draws everything and then an image loader class to load everything.

This is my image loader method that stops drawing in the panel when called

<br />
public Image[][] loadPlayerImages(){<br />
Image[][] images = new Image[4][];<br />
images[0] =    new Image[]{<br />
(new ImageIcon(getResource("gfx/Player_0/Player0_0.png"))).getImage(),<br />
(new ImageIcon(getResource("gfx/Player_0/Player0_1.png"))).getImage(),<br />
(new ImageIcon(getResource("gfx/Player_0/Player0_2.png"))).getImage(),<br />
(new ImageIcon(getResource("gfx/Player_0/Player0_3.png"))).getImage(),                 };<br />
return images;

So yeah when I call this it causes issues with the drawing it wont even draw the background which isn't even related I don't even have to attempt to draw the player to break it either.

I have no warnings no errors it just creates the window, the core of the game continues to update, it is just the drawing functions that crash when its called or something anyone else experience this?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-06-01

Hi there,
Are you still looking for help?

What is the source for the method: "getResource()"?