G4p GUI editor issues

I set up a new app and created my interface using G4P GUI editor. Everyhting was wonderful. App actually did pretty much what I wanted. Went to bed a happy camper.

Next day, I can still edit my app code in processing but the G4P editor will not open anymore.

Is this a thing?

Edit :
Seems like it may be a thing? It opens fine if I restart processing and ask it to open on a new blank sketch. But it won’t have anything to do with my sketch. As soon as I open mine and close the new sketch it vanishes and won’t open again.

Errors…

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.awt.Component$AccessibleAWTComponent$AccessibleAWTComponentHandler
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1577)
	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.readObject(ObjectInputStream.java:431)
	at javax.swing.event.EventListenerList.readObject(EventListenerList.java:274)
	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 com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:125)
	at java.awt.MenuItem.processActionEvent(MenuItem.java:669)
	at java.awt.MenuItem.processEvent(MenuItem.java:628)
	at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:357)
	at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:345)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:763)
	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)
Caused by: java.io.NotSerializableException: java.awt.Component$AccessibleAWTComponent$AccessibleAWTComponentHandler
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at javax.swing.event.EventListenerList.writeObject(EventListenerList.java:259)
	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.invokeWriteObject(ObjectStreamClass.java:1140)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
	at javax.swing.tree.DefaultTreeModel.writeObject(DefaultTreeModel.java:656)
	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.invokeWriteObject(ObjectStreamClass.java:1140)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at g4p.tool.gui.treeview.CtrlSketchView.saveModel(Unknown Source)
	at g4p.tool.gui.GuiControl.saveGuiLayout(Unknown Source)
	at g4p.tool.gui.GuiDesigner$2.windowDeactivated(Unknown Source)
	at java.awt.AWTEventMulticaster.windowDeactivated(AWTEventMulticaster.java:399)
	at java.awt.AWTEventMulticaster.windowDeactivated(AWTEventMulticaster.java:399)
	at java.awt.Window.processWindowEvent(Window.java:2069)
	at javax.swing.JFrame.processWindowEvent(JFrame.java:305)
	at java.awt.Window.processEvent(Window.java:2013)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1024)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:714)
	at java.awt.Component.dispatchEventImpl(Component.java:4760)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	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.SentEvent.dispatch(SentEvent.java:70)
	at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:239)
	at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:266)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:493)
	at java.awt.Component.dispatchEventImpl(Component.java:4760)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	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.SentEvent.dispatch(SentEvent.java:70)
	at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:239)
	at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:266)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:388)
	at java.awt.Component.dispatchEventImpl(Component.java:4760)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	... 17 more
java.lang.NullPointerException
	at g4p.tool.gui.GuiControl.makeGUIfromTreeModel(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 com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:125)
	at java.awt.MenuItem.processActionEvent(MenuItem.java:669)
	at java.awt.MenuItem.processEvent(MenuItem.java:628)
	at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:357)
	at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:345)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:763)
	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)

Thanks!

-jim lee

Sorry you are experiencing problems with GUI Builder.

Looking at the exception trace you have included I can only assume that the serialised data file that stores the GUI design has become corrupted in which case there is nothing you can do about it.

OK So I have looked at the stack trace in more detail and I have found the interesting bit

java.lang.NullPointerException
	at g4p.tool.gui.GuiControl.makeGUIfromTreeModel(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)

Starting at the bottom we have a call to the run() method. All Processing tools must have this method and is used by Processing to start the tool.

The line above it calls the constructor in the GUIDesigner class which creates the GUI Builder window and this is where things start going wrong because the window doesn’t open for you. The constructor calls the loadGuiLayout() method which is responsible for loading the GUI design from the serial file and creating a tree-model which is then passed to the makeGUIfromTreeModel(model) method

It is in this method that a null-pointer exception is thrown. Looking at the source code it is most likely that a null reference is passed instead of an actual tree model object.

Everything seems to point to the serial file being corrupted and this is extremely rare in fact in the 9 years since GUI Builder was first released no one has reported a similar experience.

Sorry I can’t be more helpful. :disappointed:

Pease tell me the versions of Processing, G4P and GUI Builder you are using - thanks

Looking at the stack trace I wonder if this is related to https://bugs.openjdk.java.net/browse/JDK-8192915 and https://github.com/AdoptOpenJDK/openjdk-jdk11u/blame/d08179796bd1de747c9afb79177f999481116821/src/java.desktop/share/classes/java/awt/Component.java#L9359

@quark using serialization as a data storage format with anything with AWT in it is probably a bad idea.

Thanks for the links they make interesting reading but I don’t believe this problem is related to the issues raised in the article because

  1. This exception would be experienced by everyone using GUI Builder and OpenJDK and that is not happening
  2. GUI Builder does not serialize any AWT or Swing components

@quark taking your points in reverse order …

Directly, maybe, but this is in the stack trace.

I just looked up if/when that particular type was Serializable. It looks like it wasn’t in JDK 8 (OpenJDK specifically isn’t relevant - same code), unless it’s been backported. As far as I can tell triggering the bug in this case (judging from the git commit) may be macOS specific, and perhaps only then in certain circumstances.

We can use the keyword transient in order to mark fields to be skipped when their class is serialized:

When using GUI Builder, the design is serialized and deserialized every time the focus shifts between the GUI Builder editor window and the Processing IDE window. If the problem was OS and/or JDK specific I would have expected this problem to show itself when the OP was creating the sketch but that wasn’t the case.

The fact that he created the sketch using GUI Builder without problem but then was unable to open it the next day makes me think the serial file has been corrupted.

G4p 4.4.1
Processing 3.5.3 – Processing revision 0269
MacOS 10.13.6

Where’s this serial file you speak of stored? Maybe I can post it somewhere?
I think this is it : link

-jim lee

So
I started a new sketch.
Fired up the G4p builder tool.
Lay out everything.
Did NOT edit any code.
Ran the app. It worked, didn’t do anything interesting but it worked as I expected.
Saved my processing file, shut down processing and…

I can’t get the G4p to open and edit the file again.

Something’s wrong and repeatable.

-jim lee

I see you found the serial file, unfortunately its not much use on its own.

Please select Archive Sketch from the tools menu and make the zip file available then I can try and discover what’s wrong.

Ok, here’s the archive : link

-jim lee

You are using GUI Builder 4.4.1 but what version of G4P are you using?

I have tried your sketch and get the same problem. Please try this sketch and let me know how you get on with it.

That opened fine. How do I figure out the version of the G4P library?

-jim lee

When you start a sketch that uses G4P it will put a message in the Processing IDE -

The sketch I uploaded which you managed to open was created with

  • GUI Builder 4.4.1
  • G4P 4.3.6
  • Processing 3.5.4
  • on an iMac running osx 10.14.6

Please try and edit the uploaded sketch then

  1. save it
  2. close Processing then
  3. restart Processing and see if it opens.

Tell me how you got on.

Same as you 4.3.6

Opened your file. Made a change adda an int, changed its value and printed it to the monitor. Saved, quit Processing, Reopened and was able to reopen the GUI tool.

Closed up everything, reopened everything, added a label to the UI. Saved, closed and I was able to re open it again.

So I guess if you start the file, I can edit it. If I start the file, I can’t.

-jim lee

So I go back to my original statement -

The only other thing I can think of is that it is some issue with the Java distribution you are using. Here is a screen shot from my Java Control Panel (accessible through System Preferences)

This is not an area I get involved in so I think I have gone as far as I can. Sorry I can’t resolve the issue for you.

As far as I can tell, I have no Java control panel. Certainly not in system preferences.

-jim lee

OK I suspect I have it because I have Eclipse installed.