GUI Form - GridLayoutManager(IntelliJ) - Resizing columns
Answered
I am new user of IntelliJ, I was using Netbeans before. For a simple frame, I created a GUI Form but I'cant resize the columns. There are green areas in the border and when mouse is over, cursor is becoming resize cursor but i can't change size.
Another problem is similar about objects. I can't resize objects as well. I can't resize them by mouse. I am changing the size parameters but still same. After I close the tab and re-open, size can be changed.
I tried to find more detail documentation about layout management in GUI form but I couldn't find. I would be glad If you can help
Thank you
Please sign in to leave a comment.
Please read about Swing Layout managers: https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html.
Layouts are flexible by design, you specify a layout type and constraints for the components, everything else is handled by the layout manager.
You are probably trying to create so called null layout when all the components have the fixed size and position and cannot be resized. IntelliJ IDEA GUI designer has no support for null layouts.
No, I don't want to use null layout. As I mentioned in title, I am using GridLayoutManager(IntelliJ).
Again, I am changing the parameters of size but the size is not changing in the form. When I close tab, and re-open (form tab), this time the size changed.
Please see this screenshot: http://imgur.com/a/mvQpy
As you can see, the width is set 10, but the width in form is not.
You can resize JPanel manually to its minimum possible size.
Sorry but I didn't understand your answer.
Resized:
Also, https://youtrack.jetbrains.com/issue/IDEA-63385 may be related.
I have two question about your screenshot;
1- Is this passwordfield resized? if yes how?
2- You see the green areas indicating layout columns. Can you resize them? If yes, how?
1. I've resized the container (JPanel) using mouse, by dragging the small right square.
2. Yes, by dragging here:
Ok. Both is not working here. Is there a setting or something like that or is it a bug?
The version is 15.0.6 Ultimate editon.
I've tested with 2016.3.4 from http://www.jetbrains.com/idea/download/index.html.
Please file an issue at https://youtrack.jetbrains.com/issues/IDEA with the sample project to reproduce and the video showing how you are trying to resize it.
I've figured out what they're asking. @Serge The reason you are able to resize while they are not is that they are using a single JPanel and storing all fields inside. That way, it does not let you resize individual fields, ONLY JPanel itself.
Solution: Check out the screenshots @Serge posted. Notice how he has 1 JPanel named "contentPanel" and another panel INSIDE that one? This is the way you design a GUI. The FORM houses JPanels. Each JPanel is basically a "section" of the window.
Example: In a basic notification window, there would be 2 JPanels. One in the center of the window that houses the text and one at the bottom that houses the "OK" button. That way, the notification TEXT and the notification BUTTON (the "ok" button) will both be resizable and separate from the other.