This site requires JavaScript, please enable it in your browser!
Greenfoot back
erdelf
erdelf wrote ...

2012/8/10

set Image returns error

erdelf erdelf

2012/8/10

#
When I want to set the image of an actor or a world, it returns the following error. Restarting Greenfoot didn't work
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Empty region!
at javax.imageio.ImageReader.computeRegions(ImageReader.java:2689)
	at com.sun.imageio.plugins.wbmp.WBMPImageReader.read(WBMPImageReader.java:184)
	at javax.imageio.ImageIO.read(ImageIO.java:1422)
	at javax.imageio.ImageIO.read(ImageIO.java:1282)
	at greenfoot.gui.images.ImageLibList$ImageListEntry.loadPreview(ImageLibList.java:412)
	at greenfoot.gui.images.ImageLibList$ImageListEntry.<init>(ImageLibList.java:401)
	at greenfoot.gui.images.ImageLibList$ImageListEntry.<init>(ImageLibList.java:376)
	at greenfoot.gui.images.ImageLibList$ImageListEntry.<init>(ImageLibList.java:368)
	at greenfoot.gui.images.ImageLibList.setDirectory(ImageLibList.java:159)
	at greenfoot.gui.images.ImageLibList.<init>(ImageLibList.java:127)
	at greenfoot.gui.images.ImageLibFrame.buildUI(ImageLibFrame.java:193)
	at greenfoot.gui.images.ImageLibFrame.<init>(ImageLibFrame.java:142)
	at greenfoot.actions.SelectImageAction.actionPerformed(SelectImageAction.java:106)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
	at java.awt.Component.processMouseEvent(Component.java:6290)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
	at java.awt.Component.processEvent(Component.java:6055)
	at java.awt.Container.processEvent(Container.java:2039)
	at java.awt.Component.dispatchEventImpl(Component.java:4653)
	at java.awt.Container.dispatchEventImpl(Container.java:2097)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
	at java.awt.Container.dispatchEventImpl(Container.java:2083)
	at java.awt.Window.dispatchEventImpl(Window.java:2482)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
	at java.awt.EventQueue.access$000(EventQueue.java:84)
	at java.awt.EventQueue$1.run(EventQueue.java:607)
	at java.awt.EventQueue$1.run(EventQueue.java:605)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:621)
	at java.awt.EventQueue$2.run(EventQueue.java:619)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
EDIT: This only happens in one scenario
davmac davmac

2012/8/10

#
It looks like you may have a BMP file in the scenario that Java's image routines can't deal with. Try moving your images out of the scenario one by one.
erdelf erdelf

2012/8/10

#
bmp right? I don't have any bmp files in this scenario. Only png, tga and pdn images
danpost danpost

2012/8/10

#
The GreenfootImage class only supports JPEG, PNG, and GIF image file formats. Resave your 'tga' and 'pdn' images in one of these formats and try again.
erdelf erdelf

2012/8/10

#
I don't use them in the scenario and in my other scenarios this isn't a problem, I just save them there.
danpost danpost

2012/8/10

#
Are you accessing the images differently in this particular scenario?
erdelf erdelf

2012/8/10

#
I just store them in the scenario folder, I don't really accessing them?
danpost danpost

2012/8/10

#
I was asking about the images that you DO use.
erdelf erdelf

2012/8/10

#
I set the images in the particular scenario the same way
danpost danpost

2012/8/10

#
It would probably be best, just to remove those extraneous images from the scenario if you are not using them. But, if you must have them there, try what davmac suggested. And if that did not work, I might go as far as trying the following: I would try creating a new scenario and create each class, copying/pasting the code from the old to the new. Then copy/paste the images and sounds from the old scenario's images and sounds folders to the new one's and see if that does not solve the problem. If it solves the problem delete the old scenario and rename the new one to the name of the old one. If you have any other extraneous files in the old one (other than images), make sure to save them, also.
erdelf erdelf

2012/8/10

#
the tga image, causes the error. Thx for your help
You need to login to post a reply.