Help a beginner? About the GUI designer.

I'm new to java, only started learning 2 weeks ago.
I'm used to C# and Visual Studio especially for the GUI designer there.
I just cant wrap my head around Intellij's GUI designer..
I cant understand how I resize buttons and such :(.
Can anyone help me or direct me to some help? I cant find any tutorials about it..
I am using the jgoodies formlayout someone recommanded me..
Also I understood that there is no support for "free design" like in visual studio where I just move things around and resize them.
So how do I learn to use this designer?

Any help is very appreciated.




You probably have to start from layout conception. It's not IDEA, but Java Swing basics like these:
Basically it means that in java you don't need to set coordinates to components. You ask the container to arrange components in some manner ("layout") and then put components into this or that "section" of chosen layout.

However, the layout you want exists. It is "null" layout:
But it's true that IDEA does not support this. It's not very typical for java applications.

Probably, you need to learn layouts first, and if FormLayout or GridBagLayout really can't satisfy your needs, then - well, you may code it manually in your sources, or find IDE that supports it.



I still cant understand how I change the size of buttons.. can you try to point me in the direction?
you really helped me, thank you!

What's better?
GridLayoutManager (IntelliJ)

I did manage to work abit with GridLayoutManager (IntelliJ).. Is BagLayout better?


You can set "Minimum Size" in the GUI designer...


In general, possible behavior of components is defined by chosen layout. Let's assume you've taken Grid (IntelliJ) or GridBag.
Then decide, do you want your buttons to change size, when the dialog is resized. Check component properties Horizontal/Vertical Align.
If you set up a component not to fill the whole layout section, then check properties like Minimum size and Maximum size.

Another question is how the _section_ defined by layout inside a container acts on container resize. Say, a section may grow, while the component inside can keep fixed size. For this check Horizontal/Vertical Size Policy in Grid (IntelliJ) and Weight in GridBag.

These two layouts are quite similar, just have a bit different properties for components adjustment. GridBag is provided by Swing, so it should work everywhere where java is installed. For Intellij layout you need to redistribute a jar from IDEA installation.

At the end of the day, only you can determine, do you like the resulted behavior of the form or not.



Maybe one more advice could be helpful: it is typical to use inner panels (typically JPanels). Say, you design a dialog with many inner components. Imagine, what big sections should your dialog consist of (e.g. a section with Ok, Cancel, Help buttons, a section with settings, a section with editor field, etc). Set a layout for root dialog panel and place sub-panels in every section. Then set layout for each sub-panel and imagine what sections they consist of. If necessary, add sub-sub-panels. Etc. Panels are invisible, they can hold all properties related to resize behavior.

I'm not a GUI expert, maybe this technic is not nice from the expert's point of view, but it gives a result. It is just commonly used.



Please sign in to leave a comment.