Java Swing: Choosing the Right LayoutManager

I am building a PropertyPanel. I am currently using GridLayoutto control JLabelsand their respective fields where I can specify a value. But the problem is that it GridLayoutautomatically controls the size of the columns: it makes them the same width.

This means that when I have a large field of values, colum gets bigger (which is good), but the other column (with all my JLabels) gets bigger. Here is a screenshot:

enter image description here   <BAD

As you can see, the property imageis of great importance, which makes both columns larger, and after JLabels I have a lot of space.

, LayoutManager, , .
( Gimp):

enter image description here   <

+5
6

SpringLayout . . SpringLayout.

:

enter image description here

, .

+5

SpringLayout - , . , GridBagLayout .

+2

, GridLayout BorderLayout, , , , ...

GridLayouts, . - .

BorderLayout .

BorderLayout.WEST BorderLayout.CENTER.

+2

11 , , . GroupLayout.

GroupLayout, SpringLayout. , SpringLayout , (, GL, , ). , Java Tutorial SpringLayout " " .

( "" ) GroupLayout.

+2

LayoutManagers: http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html

, , GridBagLayout MigLayout, GUI.

GUI (, , NetBeans), GroupLayout.

+1

All Articles