G4P java.lang.IllegalArgumentException: Width (-2) and height (10) cannot be <= 0

Hi there,
sadly, i already need your help again. Yesterday the last thing i did was to export my grapher-sketch to an executable and after that closed processing. When i tried to open gui builder today to continue working on the .pde, i got the error message:

java.lang.IllegalArgumentException: Width (-2) and height (10) cannot be <= 0
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
... (more code/message below)

Since the last thing i did was do an export, and that’s it, i dont know whats going on. I read it could have to do with images beeing loaded before their dimensions are set or with falsely scaled gui elements. I have no gui element with the width of (-2) in my gui tab and i did not make any changes to my latest running version anyway. I use one image in the whole sketch which is an icon for a button, but that did not cause any problems the many times before.
If i’d had to go back to my now latest working version (the one i did not export to an exe), that would be many hours of work missing. What could cause this bug?

Full error message:

===================================================
   G4P GUI Builder 4.4.1 created by Peter Lager
===================================================
java.lang.IllegalArgumentException: Width (-2) and height (10) cannot be <= 0
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
	at g4p_controls.StyledString.getParagraghSpacer(Unknown Source)
	at g4p_controls.StyledString.readObject(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2211)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1975)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1567)
	at java.io.ObjectInputStream.access$800(ObjectInputStream.java:214)
	at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2452)
	at java.io.ObjectInputStream.readFields(ObjectInputStream.java:601)
	at java.util.Vector.readObject(Vector.java:1077)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:561)
	at javax.swing.tree.DefaultMutableTreeNode.readObject(DefaultMutableTreeNode.java:1294)
	at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1975)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1567)
	at java.io.ObjectInputStream.access$800(ObjectInputStream.java:214)
	at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2452)
	at java.io.ObjectInputStream.readFields(ObjectInputStream.java:601)
	at java.util.Vector.readObject(Vector.java:1077)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:561)
	at javax.swing.tree.DefaultMutableTreeNode.readObject(DefaultMutableTreeNode.java:1294)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:561)
	at javax.swing.tree.DefaultTreeModel.readObject(DefaultTreeModel.java:667)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1170)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2178)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
	at g4p.tool.gui.treeview.CtrlSketchView.loadModel(Unknown Source)
	at g4p.tool.gui.GuiControl.loadGuiLayout(Unknown Source)
	at g4p.tool.gui.GuiDesigner.<init>(Unknown Source)
	at g4p.tool.G4PTool.run(Unknown Source)
	at processing.app.contrib.ToolContribution.run(ToolContribution.java:124)
	at processing.app.Base$5.actionPerformed(Base.java:852)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:842)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:886)
	at java.awt.Component.processMouseEvent(Component.java:6539)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

My createGUI() code, but cut to the part containing the icon because the whole of it did not fit into the character limit:

  button_Processing = new GButton(window2_info, 80, 660, 310, 130);
  button_Processing.setIcon("madeWithProcessing_small.png", 1, GAlign.EAST, GAlign.CENTER, GAlign.MIDDLE);
  button_Processing.addEventHandler(this, "button1_click2");

I really hope it is just a dumb oversight or an really esay fix, and not something one can’t reach anymore. That would be so much time and work lost. Please help me and thanks in advance. If you need more of my code to work with, say it.

OK the first thing to do is confirm that the image is being exported with the code.

Now it is a long time since I exported any sketch but one thing I do remember - ALL resources must be in the data folder or they don’t get exported. So in your sketch folder create a new folder called data and put all your images or other resources e.g. list files for drop boxes, sound files etc. in the data folder. You do not need to modify any code when doing this since Processing looks in the data folder as well as the sketch folder and G4P takes care of its own images.

Hello and thanks for the response - again.
So the data folder aldready existed from the moment on i created the first droplist, which is a long time ago. It contains a few droplist-generated lists, a user-gui-palette (which is also many versions old) and since a few versions the one and only button label image. And the data folder was successfully exported with the application and the application runs absolutely perfect without exceptions or any error. The label is visible in the exe and the button works correctly. So:
-The pde did work correctly and G4P also (now the pde still works - i can still start the sketch in processing, but G4P wont start anymore and throws the said error)
-the exported app works as expected
-the error came out of nowhere and in my gui tab i defently have no element with any negative dimension

I guess i manually have to rework the lost code with the help of the app and the sketch both luckily remaining as templates. And the main code can be copied 1:1 from the latest version, then i just have to rework all the controls, layouts and dimensions i did since the last version. Next time i will copy the version i want to test in an exe under a different name, so when exporting really breaks something, it will brake a copy.