Check the GridLayout api to see that the grid is made so that all cells are the same size. If you want it to show the preferred size, for example (15,15), add it to JPanel and add JPanel to GridLayout. JPanel will expand to fill the gird cell and allow the component to display its preferred size.
For a string of different sizes, you have to try something else. Nested layouts would be a good starting point ...
You can always use the scary GridBagLayout.
Mayank pandya
source share