Search code examples
javaintellij-ideadesignergui-designer

Auto Generate Code For Form Components In Form Building In IntelliJ


Hello guys I am new to programming. I used NetBeans first but didn't like the UI. I switched to IntelliJ.... but while creating forms in Netbeans some code was auto generated like the button info etc etc. I would like to have the same in IntelliJ but can't find this feature anywhere. Can you guys please help me?


Solution

  • Most likely the generated code made by NetBeans vs IntelliJ will be different, and there isn't much you can do about it. By default IntelliJ will not create actual code for auto-generated UIs, but instead will create binary files that will directly create a class file for a UI class at compile time. You can modify this setting, however it does not guarantee that it will be the same as what NetBeans generated, or that it will be parsable for use in IntelliJ's swing designer, so just be aware.

    To answer your actual question though you can change from binary files to generated Java source files via the following:

    File -> Settings -> Editor -> GUI Designer.
    Modify the item named "Generate GUI into" and set it to Java source files.

    Take a look at this section of the IntelliJ manual: https://www.jetbrains.com/idea/help/gui-designer.html