Similar questions has been asked but no good answers and nothing that worked for me (1, 2, 3).
In my Maven
's project, I'm using IntelliJ IDEA
's UI designer
and every once in a while I'm getting (maybe it have something to do with me running maven clean & install)
"contentPane cannot be set to null."
To fix it I simply change the panel name using the UI designer, but this solution is not good for running a jar made of my code, and I'm trying to understand the problem and find a more permanent solution.
As you can see below, I haven't checked the "Custom Create" box, and as far as I know, it means that the designer is automatically initializing it (otherwise renaming the panel won't fix it).
swing frame
public class MyFrame extends JDialog {
private JPanel contentPanel;
.
.
.
private MyFrame() {
setContentPane(contentPanel);
.
.
}
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>app.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>ideauidesigner-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>javac2</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<debug>true</debug>
<failOnError>true</failOnError>
</configuration>
</plugin>
.
.
.
</build>