GUI Form creation - code not generated

Hi, I am very new to IDEA and it could be that I am doing something wrong but anyway I need help
on creation of GUI Forms.

Everything goes fine with usual design of form, adding components etc...

However, IDEA is not generating code for adding components, e.g. form class not extending JFrame,
there is no $$$methodname$$$ methods which are mentioned in online docs, no constructor/method which adds components to main panel etc.

I thought that code might be generated with explicit making of module/project, but that is not the case.

What I am doing wrong? Any suggestion, help, advice is appreciated.

Thanks.

4 comments

By default IntelliJ IDEA generates the form setup code directly to bytecode when you build the project. If you need to see the source code for some reason, you can go to the UI Designer settings and enable source code generation.

0

Well then probably I am doing something wrong because
when I try to set form visible e.g.

myForm.setVisible(true); //instantiated somewhere...


IDEA is not offering (intellisense) "setVisible" method or not any other belonging to JComponent, JFrame or whatever,
and also compiler complains about myForm (class created by gui designer and bound to form) not having such method...
0

If you need your form class to extend JFrame or JComponent or any other class, you have to specify the superclass explicitly in your class definition (and in the case of JFrame, to set the top-level panel generated by the GUI Designer as the top-level component for the frame). The GUI Designer doesn't add any implicit superclass to your form.

0

I got it... works quite ok... although I think that without code generation turned on process is not transparent,
and everything happens under the hood, but that is probably matter of taste.

Anyway, your suggestions were very helpful,
thanks.

0

Please sign in to leave a comment.