I am developing a GUI in java using Netbeans (7.0).
I have a JFrame including a JPanel and several elements inside this panel.
The layout type is free layout I think.
draft:
-------------------
|JFrame |
| |
| --------------- |
| |JPanel | |
| | | |
| | elem1 elem2 | |
| | elem3 elem4 | |
| | elem5 elem6 | |
| | | |
| |-------------- |
| |
-------------------
During my program is running I am hiding some of the elements being in one row (e. g. elem3 and elem4) by using setVisible(false).
Everything resizes as expected (JFrame and JPanel) except for the gaps. It looks like that the elements are hidden correctly but there gaps are remaining so that in my example where I am hiding elem3 and elem4 a bigger gap between the row elem1/elem2 and elem5/6 remains.
Hopefully my problem was understandable :-)
Is there any way to fix this behavior?
Thanks in advance.
Steffen