Why does GridLayout ignore the number of columns I specify?
I'm learning how to use layout managers, and I've come to learn that when the GridLayout constructor is set with both the number of rows and columns to non-zero values, it ignores the number of columns I specify and re-sizes them to (numComponents + numRows - 1)/numRows. Setting the number of rows or columns to 0 fixes this orientation problem easily enough, but I am still left wondering what the purpose is for this. Why would GridLayout ignore the parameters of its own constructor? If I want 6 rows and 7 columns I should be able to call new GridLayout(6, 7) and not have to worry about the number of components I have changing the number of columns on me. I just don't see the point, why is GridLayout set up this way?
Re: Why does GridLayout ignore the number of columns I specify?
it is my understanding that when you set it to 0 it tells it that you dont know how many you will have instead of going back when you need to add another row or column and changing the numbers...i too am having trouble with layout managers so i cant really answer the other parts of the question cause i have trouble with that too lol
i believe you can only put 1 component in each piece of the grid but im not positive so maybe someone else could explain better