What is the expected schema for GUI forms?
We have a lot of GUI forms in our project. A few of them are broken (for years). I decided to fix it. I know it is discouraged to manually edit those XML files, but here we are. I don't see any way around it (other than recreating those forms from scratch which is a risky and time-consuming strategy)
In case you're wondering what I mean by “broken”, it's this. The screenshot is taken after trying to open the form file associated with BookingPane

After investigation, I found out that BookingPane is actually fine, the problem is with its nested form, GraphPane. I commented in and out parts of the GraphPane form, and here's what I discovered. When you comment out the last declared component, it's rendered fine in the IDE. The snippet below is the file in full
BookingHeader used to contain some paintComponent() code, but now I removed all of it, and the problem still persists
```form
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="graph.GraphPane">
<grid id="27dc6" binding="mainPanel" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="704" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="3b41b" binding="bookingScrollPane">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="700" height="-1"/>
<preferred-size width="700" height="-1"/>
</grid>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties>
<minimumSize width="700" height="-1"/>
<verticalScrollBarPolicy value="22"/>
</properties>
<border type="none"/>
<children>
<component id="accb1" class="booking.BookingPanel" binding="bookingPanel">
<constraints/>
<properties>
<background color="-1"/>
</properties>
</component>
</children>
</scrollpane>
<grid id="25314" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children> <!--
<component id="e6331" class="booking.BookingHeader" binding="bookingHeader">
<constraints border-constraint="Center"/>
<properties>
<background color="-1"/>
<focusable value="true"/>
<minimumSize width="10" height="17"/>
<opaque value="true"/>
<preferredSize width="10" height="17"/>
</properties>
</component> -->
<grid id="b94e8" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints border-constraint="East"/>
<properties>
<maximumSize width="17" height="15"/>
<minimumSize width="17" height="15"/>
<preferredSize width="17" height="15"/>
</properties>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
</form>
```
```java
package booking;
import javax.swing.*;
// removed all the code
public class BookingHeader extends JPanel {}
```

If I reintroduce the last component, I get a similar “broken” effect:

What's wrong with the form file?
IntelliJ IDEA 2024.1 (Community Edition)
Build #IC-241.14494.240, built on March 28, 2024
Runtime version: 17.0.10+8-b1207.12 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
Lombook Plugin (241.14494.240)
AntSupport (241.14494.158)
Kotlin: 241.14494.240-IJ
Please sign in to leave a comment.
Hi - can you share a demo project where this is reproducible?
You can upload it to our server at https://uploads.jetbrains.com.
I'm not sure I can. It's big. Do you notice any issues with the pasted form file? It works unless I uncomment the commented out component. The problem must be there
I tried Reload Custom Components, and it helped
but only temporarily. Now, nothing helps (including Reload Custom Components and the IDE's cache invalidation). And I get a specific error
```
2024-06-17 17:37:46,200 [ 166154] INFO - #c.i.u.d.GuiEditor - Argument for @NotNull parameter 'aClass' of com/intellij/uiDesigner/radComponents/RadComponent.<init> must not be null
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'aClass' of com/intellij/uiDesigner/radComponents/RadComponent.<init> must not be null
at com.intellij.uiDesigner.radComponents.RadComponent.$$$reportNull$$$0(RadComponent.java)
at com.intellij.uiDesigner.radComponents.RadComponent.<init>(RadComponent.java)
at com.intellij.uiDesigner.radComponents.RadContainer.<init>(RadContainer.java:74)
at com.intellij.uiDesigner.radComponents.RadToolBar.<init>(RadToolBar.java:31)
```
Worse still, now all forms can't be opened in the IDE. The error is the same
I got no idea what it means and what I should do about it
Could you please upload your
idea.logfile to https://uploads.jetbrains.com and provide the id of the upload here?Help | Show Log in…
I will extract the stack trace and submit a new bug report to our issue tracker.