GridLayoutManager - adding new components

I'am using idea 12 community edition. We are writing a school project in java. Threre is a mainframe and other views created as GUI Form and GridLayoutManager in the idea gui manager.

We want to fill the Jpanel's with other views in the runtime. It seems I have to use GridConstraints when adding. I coulldn't find a good tutorial for this and when i add the component like

leftPanel.add(leftMenu.getLeftMenuContainerpanel() , new GridConstraints()  );          //(leftPanel has a label in it.)

When i run this, menu goes behind the label. I want to add menu after the label.

Comment actions Permalink

Hi Enes,

Why do you want to use GridLayoutManager for non-GUI-designer UI? You can just add a JPanel at GUI Designer and make it use any standard swing layout.

For example, here is a class from IJ codebase - EditorAppearanceConfigurable. Notice how it defines an empty panel (myAddonPanel) which is managed by GridBagLayout and adds content at runtime to it.


Comment actions Permalink

Thanks a lot.
I am going to try miglayout and gridbaglayout.
Have a nice day.


Please sign in to leave a comment.