IntelliJ IDEA UI Designer表单元素初始化为null [英] IntelliJ IDEA UI Designer form elements initialize to null
问题描述
我开始在笔记本电脑上开发一个简单的工具,并希望将项目移至PC.因为我使用版本控制,所以我首先只是克隆了存储库,在此之后不起作用,我还尝试了复制文件.
I started developing a simple tool on my laptop and wanted to move the project to my PC. Because i use version control I first simply cloned the repo, after that did not work I also tried copying the files.
解决了一些字符问题后,初始化主窗体时得到一个NullPointerException
.我的笔记本电脑上没有那个异常.
After fixing some character issues, I get a NullPointerException
when initializing my main form. I don't have that exception on my laptop.
我还发现,即使表单已绑定到该类,Java类中的每个表单元素也都初始化为null.
I also found out that every single form element in the Java class is initialized to null, even though the form is bound to the class.
推荐答案
这是已知问题将构建委托给Gradle.
It's a known issue when the build is delegated to Gradle.
解决方法是禁用构建委托并将编译切换到IntelliJ IDEA:
The workaround is to disable the build delegation and switch compilation to IntelliJ IDEA:
另一个选择是配置Gradle以构建表单,看到这个答案.
Another option is to configure Gradle to build the forms, see this answer.
这篇关于IntelliJ IDEA UI Designer表单元素初始化为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!