I am still a little confused, becaus I reall do not understand why the GridLayout behaves like this.
I don't really see what the problem is. Make the Window smaller vertically, and life will be roses.
Just an FYI, Java layout managers all draw components so that the fill the entire area. In this case your grid cells are large, so GridLayout fills the cells with the components. If you don't want the components to do this (e.g. you want lots of extra space around them) either find a third party layout manager that does what you need, or write your own.
Huh? Perhaps I don't understand you suggestion. For testing purposes I added one GridLyout-Panel into the Center of an BorderLayout JFrame(). When I use frame.pack()
it works. But as soon as I modify the size (even if i drag it wider!) it gets disordered. Changing the size, vertically, horizontally, smaller, larger whatever does not restore my
So, wheres the logic? Why does not the order gets the main priority? I think, if the screen gets larger, theres no problem, then all components can be widened too.
If it gets smaller you can shrink all components as far as they all can be displayed. Then you have to cut something off.
Other suggestions to LayoutManagers are nice but for some reasons I need to fix the problem with GridLayout.