On Sat, 29 Nov 2025 16:04:51 GMT, John Hendrikx <[email protected]> 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";
>  />

This pull request has now been integrated.

Changeset: d997dd8b
Author:    John Hendrikx <[email protected]>
URL:       
https://git.openjdk.org/jfx/commit/d997dd8b7eb6665bbd6890f6cabb4e22a4950e4a
Stats:     51 lines in 1 file changed: 27 ins; 4 del; 20 mod

8092379: GridPane should not render extra gaps when entire rows or columns are 
unmanaged

Reviewed-by: angorya, mstrauss

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

PR: https://git.openjdk.org/jfx/pull/1990

Reply via email to