The form bound to the class does not have a valid binding for the root component

IDEA 写swing程序 生成Form Main报错  

The form bound to the class does not have a valid binding for the root component


解决办法:


I was stumped when IntelliJ consistently errored out when choosing Form main() from the insert menu, with an error message saying something about an invalid root component.

It turns out it means that the JPanel that is the main (root) component of your Form needs to have a field bound to it, and by default it doesn't do this.

Simply select the JPanel in the form designer, and give it a name (field name) in the property pane.

After this it will generate the main() just fine.


你可能感兴趣的:(The form bound to the class does not have a valid binding for the root component)