I can't seem to run a form on IntelliJ GUI builder
Exception in thread "main" java.awt.IllegalComponentStateException: contentPane cannot be set to null.
I assume the code to initialize the views are auto generated. Right now I only have a JPanel
and somehow it is not auto-initialized even thought it's clearly visible on the designer.
It's a Gradle project and I've chosen to run with the generated main function.
What do I have to do to get it working?
public class MyForm {
private JPanel jPanel;
public static void main(String[] args) {
JFrame frame = new JFrame("MyForm");
frame.setContentPane(new MyForm().jPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}