Jump to content
  • Advertisement
Sign in to follow this  
Compunerd

Untitled

This topic is 3815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In MenuTest the menu image Supposedly can't be found even though the menu package is in the images package as the code indicates that it should be. The code is: // load the image String imagePath = "../images/menu/" + name + ".png"; ImageIcon iconRollover = new ImageIcon(imagePath); int w = iconRollover.getIconWidth(); int h = iconRollover.getIconHeight(); The response I get when I run MenuTest is:Exception in thread "main" java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999) at java.awt.GraphicsConfiguration.createCompatibleImage(GraphicsConfiguration.java:163) at com.brackeen.javagamebook.graphics.ScreenManager.createCompatibleImage(ScreenManager.java:256) at geoff.MenuTest.createButton(MenuTest.java:151) at geoff.MenuTest.init(MenuTest.java:48) at geoff.KeyConfigTest.init(KeyConfigTest.java:42) at com.brackeen.javagamebook.test.GameCore.run(GameCore.java:47) at geoff.KeyConfigTest.main(KeyConfigTest.java:29) What could be WRONG that the compiler keeps stating Illegal exception

Share this post


Link to post
Share on other sites
Advertisement
Please rename the post.

Please check if the icon was loaded in to memory correctly. Check whether the iconRollover contains the image or not by using the debugger.

It is not the compiler that is complaining, you have a runtime error.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!