RFR: 8092379: GridPane should not render extra gaps when entire rows or columns are unmanaged [v4]

Andy Goryachev angorya at openjdk.org
Mon Dec 1 22:39:03 UTC 2025


On Sat, 29 Nov 2025 20:51:38 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> This fixes a long standing bug with `GridPane` where unmanaged nodes would still result in gaps being added between rows/columns even though nothing is rendered there.  Take the following grid where dashes and pipes represent the vgaps and hgaps:
>> 
>> |            |0| |1|
>> |--------|---|---|---|
>> |0  |A|||B|
>> |    |-|||-|
>> |1  |C|||D|
>> |    |-|||-|
>> |2  |E|||F|
>> 
>> Now, when both C and D are set to unmanaged (and invisible) the grid will **still** render the gaps:
>> 
>> |            |0| |1|
>> |--------|---|---|---|
>> |0  |A|||B|
>> |    |-|||-|
>> |1  |||||
>> |    |-|||-|
>> |2  |E|||F|
>> 
>> Instead it should collapse the gap between row 0 and 2:
>> 
>> |            |0| |1|
>> |--------|---|---|---|
>> |0  |A|||B|
>> |    |-|||-|
>> |2  |E|||F|
>> 
>> There are at least two relevant issues in JBS:
>> - A request to let the user show and hide rows and columns: https://bugs.openjdk.org/browse/JDK-8136901
>>   - This can now be done by setting the relevant row/columns items to unmanaged without having to restructure the grid (assuming the complaint was that otherwise there'd be visible extra gaps for each hidden row)
>> - A request for another mode to skip gaps when entire rows/columns are unmanaged: https://bugs.openjdk.org/browse/JDK-8092379
>>   - This should not be a mode, but the standard, as unmanaged nodes should not affect the outcome of the grid layout
>> 
>> Screenshots
>> 
>> Simple application which can hide row 3:
>> 
>> <img width="443" height="491" alt="image" src="https://github.com/user-attachments/assets/0342dba3-cd1c-4d9e-9451-e9c8c628b2e2" />
>> 
>> Correct behavior when row 3 is hidden:
>> 
>> <img width="443" height="408" alt="image" src="https://github.com/user-attachments/assets/c7c54414-6a03-43e4-b733-21d0b251d729" />
>> 
>> Behavior before this fix (note the double gap **and** extra grid line):
>> 
>> <img width="443" height="453" alt="image" src="https://github.com/user-attachments/assets/f357e68a-e950-42e7-890b-91a78e194dd0" />
>
> John Hendrikx has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   When all nodes starting in a row or column are unmanaged, skip gap

huge pain, yes, that's why I am still working on https://github.com/andy-goryachev/FxDock/blob/master/doc/CPane.md

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1990#issuecomment-3599249915


More information about the openjfx-dev mailing list