Gui designer - how to actually display the form.

Hi,

I created a form using the GUI designer and have it set to generate Java source code. How do I actually create this panel?

I can see from another discussion that there may need to be a function "$$$getRootComponent$$$" in the class for the form - but that doesn't exist for my class

http://devnet.jetbrains.net/message/5262090#5262090

So how do I create the form and attach it to the JFrame that is running my application? Attached is the complete class as generated by the GUI designer.

cheers
Dan

btw running Idea 11.1.0.616



Attachment(s):
MergeForm.java.zip
4 comments
Comment actions Permalink

You can press Alt-Ins and select "Form main()" to generate a sample main() function that would create and display the form.

0
Comment actions Permalink

Any idea what the key combination on a Mac laptop is? I have no insert key.

Or is it available through a menu?

cheers
Dan

0
Comment actions Permalink

Code | Generate...
IIRC it's bound to ^N in the default Mac keymap.

0
Comment actions Permalink

Thanks Dmitry,

One thing that is odd is that the generated code didn't work correctly. The generated code had:

public JPanel testingPanel;

but then 'testingPanel' was never actually set anywhere and so it crashed with null-pointer error. Changing it to:

public JPanel testingPanel = new JPanel();

made it work.

cheers
Dan

0

Please sign in to leave a comment.