On Mon, 1 Dec 2025 22:34:34 GMT, Andy Goryachev <[email protected]> wrote:

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

:-)

I created my own `Flex` layout, which is a combination of HBox + VBox + 
GridPane.  It basically works by looking at how they are nested.  If you nest 
multiple horizontal flexes into a vertical flex:

     FlexV
           FlexH [ label , text field ]
           FlexH [ label , text field ]

The above would produce an unaligned mess when the labels are different 
lengths, just like nesting HBoxes into VBox would.  However, the Flex has a 
property "aligned" that you can set, and it will affect the layout of any 
nested flexes of the opposite type.  In this case, if you give the top FlexV 
this property, the nested horizontal flexes will automatically align as if they 
were in a grid.

It looks like this in code (in builder form):

        Panes.vflex("form").aligned().nodes(
          Panes.hflex().nodes(
            "Width",
            FX.spinner().editable().value(parameters.width)
          ),
          XPanes.hflex().nodes(
            "Height",
            FX.spinner().editable().value(parameters.height)
          )
        );

I actually only use `GridPane` in my samples, as I'm not ready yet to publish 
`Flex`.

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

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

Reply via email to