How do I convert NetBeans form and its class to something usable in IntelliJ IDEA form editor?

I apologize for perhaps naive question but I couldn't find an answer online. I've got some UI code that was created in NetBeans. Unfortunately I don't know what version was used. My understanding is that IntelliJ IDEA (v11 in my case) doesn't support NetBeans forms. Can I convert the form to something usable in IDEA's form editor ? Content of form's XML file looks lie this:

Thanks a lot. asked Dec 7, 2011 at 10:16 29.9k 31 31 gold badges 114 114 silver badges 219 219 bronze badges

Have you tried a copy/paste of the code? I've never done this before I would imagine that it would work.

Commented Dec 7, 2011 at 10:20 .java class that comes with .form ? Where should I copy-paste it ? Commented Dec 7, 2011 at 10:28

You would have to create a class with the same name in the same package in IntelliJ and then copy/paste the code from your class into that one. You could also try just opening the file in IntelliJ and see if IntelliJ will open it (it should). The code generated by NetBeans is valid Java code and will work without the .form file. The .form file is there to facilitate the GUI editor and is not needed/used to compile the .java class.

Commented Dec 7, 2011 at 10:35

Ah ok, I should have said in the post that I want to use Form Designer to modify NetBeans form (or something that will be generated from it). I updated my question.

Commented Dec 7, 2011 at 10:48

Ah, I see. Well you could discover this by creating a similar form with Form Designer and compare the output of both. It would be a good learning exercise. Another thing to seriously consider is doing without the GUI designers all together. I find that they only get in the way (case in point).

Commented Dec 7, 2011 at 11:00

2 Answers 2

IntelliJ IDEA doesn't support NetBeans forms, you can try to use the create snapshot feature that can save IDEA form file from a dialog of the running application.

However, much more convenient solution would be to use JFormDesigner which has IntelliJ IDEA plug-in and can convert NetBeans form files. Note that this tool is commercial and will cost you money, but it's free to try.

answered Dec 7, 2011 at 11:58 CrazyCoder CrazyCoder 399k 178 178 gold badges 1k 1k silver badges 930 930 bronze badges

Yesterday I tried JFormDesigner 5.0.0 and it was crashing in IDEA 11. But version 5.0.2 works fine. I'll stick with it. Thanks!

Commented Dec 7, 2011 at 22:26

let suppose I build one from during its evaluation period and if licence expire than will that form will still working or I can not modify it?

Commented Mar 12, 2017 at 14:05

I have had perfect success by simply opening up the Source tab in the NetBeans Form editor where I created the form and copying the entirety of the code into a new Class in IntelilJ, then simply adding the code for a new JFrame and its code and passing (this) to the Panel parameter at the bottom of the initComponentsGui method.

public class ConvertedGui extends Panel < // my new class private void initComponents(). // copied code // >>> the copied code here >>> JFrame frame = new JFrame("Title For JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1440, 900);// or your preferred size frame.add(this); frame.setVisible(true);` > // >>> More copied code for all the actionListeners etc.>>>